ConFoo Montreal 2026: Call for Papers

Voting

: five minus four?
(Example: nine)

The Note You're Voting On

gskluzacek dot nospam at gmail dot com
14 years ago
if you simply want to dynamically call a method on an object it is not necessary to use call_user_function but instead you can do the following:

<?php

$method_name
= "AMethodName";

$obj = new ClassName();

$obj->{$method_name}();

?>

I've used the above so I know it works.

Regards,
-- Greg

<< Back to user notes page

To Top