Function name must be a string¶
Description¶
When calling a function dynamically, the name of the function, in the $method
variable, must be a string, and the function must exist.
Some other scalars, such as integer, might be used as function name, although it will fail.
Example¶
<?php
$method = new stdClass;
$method();
?>
Solutions¶
Only use string names for dynamic call to functions.
Cast the variable to string before using it.
In more recent PHP versions, this error message is now Object of type %s is not callable.