Calling User Functions

You can call user functions from your own modules, which is very handy when implementing callbacks - for example, for array walking, searching, or simply for event-based programs.

User functions can be called with the function call_user_function_ex(). It requires a hash value for the function table you want to access, a pointer to an object (if you want to call a method), the function name, return value, number of arguments, argument array, and a flag indicating whether you want to perform zval separation:

ZEND_API call_user_function_ex(HashTable *function_table, zval *object, zval
 *function_name, zval **retval_ptr_ptr, ...

Get Web Application Development with PHP 4.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.