calling user functions


Calling User FunctionsPHP ManualPrevAppendix B. PHP developmentNextCalling User Functions To call user functions from an internal function, you should use the call_user_function() function. call_user_function() returns SUCCESS on success, and FAILURE in case the function cannot be found. You should check that return value! If it returns SUCCESS, you are responsible for destroying the retval pval yourself (or return it as the return value of your function). If it returns FAILURE, the value of retval is undefined, and you mustn't touch it. All internal functions that call user functions must be reentrant. Among other things, this means they must not use globals or static variables. call_user_function() takes six arguments: HashTable *function_table This is the hash table in which the function is to be looked up. pval *object This is a pointer to an object on which the function is invoked. This should be NULL if a global function is called. If it's not NULL (i.e. it points to an object), the function_table argument is ignored, and instead taken from the object's hash. The object *may* be modified by the function that is invoked on it (that function will have access to it via $this). If for some reason you don't want that to happen, send a copy of the object instead. pval *function_name The name of the function to call. Must be a pval of type IS_STRING with function_name.str.val and function_name.str.len set to the appropriate values. The function_name is modified by call_user_function() - it's converted to lowercase. If you need to preserve the case, send a copy of the function name instead. pval *retval A pointer to a pval structure, into which the return value of the invoked function is saved. The structure must be previously allocated - call_user_function() does NOT allocate it by itself. int param_count The number of parameters being passed to the function. pval *params[] An array of pointers to values that will be passed as arguments to the function, the first argument being in offset 0, the second in offset 1, etc. The array is an array of pointers to pval's; The pointers are sent as-is to the function, which means if the function modifies its arguments, the original values are changed (passing by reference). If you don't want that behavior, pass a copy instead. PrevHomeNextPHP developmentUpReporting Errors

Wyszukiwarka

Podobne podstrony:
calling user functions
calling user functions
zend calling user functions
User Functions
function vpopmail auth user
function call user method array
function vpopmail del user
function vpopmail set user quota
function mysql change user
function ignore user abort
function call user func array
function user error
function call user method array
function vpopmail add user
function ignore user abort

więcej podobnych podstron