Page 1 of 1

Calling a function dynamically

Posted: Sun May 04, 2008 10:34 pm
by aliasxneo
Is there any difference between these lines of code:

Code: Select all

$result = $funcName();

Code: Select all

$result = call_user_func($funcName);
Is there anything PHP does in the background with call_user_func() that is important and/or necessary?

Re: Calling a function dynamically

Posted: Sun May 04, 2008 10:42 pm
by John Cartwright
Significant changes in the background? No. The only real difference is how errors are handled.

Re: Calling a function dynamically

Posted: Sun May 04, 2008 10:46 pm
by aliasxneo
Jcart wrote:Significant changes in the background? No. The only real difference is how errors are handled.
I see. So instead of the normal error reporting call_user_func will just return false?