From c87c5a19921df902acf991d13287e5fa701ee432 Mon Sep 17 00:00:00 2001 From: Mehdi Achour Date: Sat, 17 Feb 2007 20:02:43 +0000 Subject: [PATCH] WS, prepapre for new doc style git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@230097 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../functions/call-user-func-array.xml | 70 +++---- .../funchand/functions/call-user-func.xml | 110 +++++----- .../funchand/functions/create-function.xml | 194 +++++++++--------- reference/funchand/functions/func-get-arg.xml | 88 ++++---- .../funchand/functions/func-get-args.xml | 90 ++++---- .../funchand/functions/func-num-args.xml | 80 ++++---- .../funchand/functions/function-exists.xml | 76 ++++--- .../functions/get-defined-functions.xml | 80 ++++---- .../functions/register-shutdown-function.xml | 152 +++++++------- .../functions/register-tick-function.xml | 84 ++++---- .../functions/unregister-tick-function.xml | 41 ++-- 11 files changed, 524 insertions(+), 541 deletions(-) diff --git a/reference/funchand/functions/call-user-func-array.xml b/reference/funchand/functions/call-user-func-array.xml index ae65e46bcd..d988d7788b 100644 --- a/reference/funchand/functions/call-user-func-array.xml +++ b/reference/funchand/functions/call-user-func-array.xml @@ -1,33 +1,31 @@ - + - - - call_user_func_array - - Call a user function given with an array of parameters - - - - Description - - mixedcall_user_func_array - callbackfunction - arrayparam_arr - - - Call a user defined function given by - function, with - the parameters in param_arr. - For example: - - - - <function>call_user_func_array</function> example - + + + call_user_func_array + Call a user function given with an array of parameters + + + Description + + mixedcall_user_func_array + callbackfunction + arrayparam_arr + + + Call a user defined function given by + function, with + the parameters in param_arr. + For example: + + + + <function>call_user_func_array</function> example + ]]> - - - - - See also - call_user_func, - and &seealso.callback; - - - + + + + + See also + call_user_func, + and &seealso.callback; + + + + - - - call_user_func - - Call a user function given by the first parameter - - - - Description - - mixedcall_user_func - callbackfunction - mixedparameter - mixed... - - - Call a user defined function given by the - function parameter. Take the - following: - - - - + + + call_user_func + Call a user function given by the first parameter + + + Description + + mixedcall_user_func + callbackfunction + mixedparameter + mixed... + + + Call a user defined function given by the + function parameter. Take the + following: + + + + ]]> - - - - - Class methods may also be invoked statically using this function - by passing array($classname, $methodname) to - the function parameter. - - + + + + + Class methods may also be invoked statically using this function + by passing array($classname, $methodname) to + the function parameter. + + ]]> - - - - - - Note that the parameters for call_user_func are not - passed by reference. - - + + + + + + Note that the parameters for call_user_func are not + passed by reference. + + ]]> - - - - - - See also: - is_callable, - call_user_func_array, - &listendand; &seealso.callback;. - - - + + + + + + See also: + is_callable, + call_user_func_array, + &listendand; &seealso.callback;. + + + + - - - create_function - Create an anonymous (lambda-style) function - - - Description - - stringcreate_function - stringargs - stringcode - - - Creates an anonymous function from the parameters passed, and - returns a unique name for it. Usually the - args will be passed as a single quote - delimited string, and this is also recommended for the - code. The reason for using single quoted - strings, is to protect - the variable names from parsing, otherwise, if you use double - quotes there will be a need to escape the variable names, e.g. - \$avar. - - - You can use this function, to (for example) create a function - from information gathered at run time: - - - - - Creating an anonymous function with <function>create_function</function> - - + + + create_function + Create an anonymous (lambda-style) function + + + Description + + stringcreate_function + stringargs + stringcode + + + Creates an anonymous function from the parameters passed, and + returns a unique name for it. Usually the + args will be passed as a single quote + delimited string, and this is also recommended for the + code. The reason for using single quoted + strings, is to protect + the variable names from parsing, otherwise, if you use double + quotes there will be a need to escape the variable names, e.g. + \$avar. + + + You can use this function, to (for example) create a function + from information gathered at run time: + + + + + Creating an anonymous function with <function>create_function</function> + + ]]> - - - - - Or, perhaps to have general handler function that can apply a set - of operations to a list of parameters: - - - - - Making a general processing function with - <function>create_function</function> - - + + + + + Or, perhaps to have general handler function that can apply a set + of operations to a list of parameters: + + + + + Making a general processing function with + <function>create_function</function> + + ]]> - - - and when you run the code above, the output will be: - - + + + and when you run the code above, the output will be: + + - - - - - But perhaps the most common use for of lambda-style (anonymous) functions - is to create callback functions, for example when using - array_walk or usort - - - - Using anonymous functions as callback functions - + + + + + But perhaps the most common use for of lambda-style (anonymous) functions + is to create callback functions, for example when using + array_walk or usort + + + + Using anonymous functions as callback functions + ]]> - - - outputs: - - + + + outputs: + + this mango ) ]]> - - - an array of strings ordered from shorter to longer - - + + + an array of strings ordered from shorter to longer + + ]]> - - - outputs: - - + + + outputs: + + it is a string thing ) ]]> - - - sort it from longer to shorter - - + + + sort it from longer to shorter + + ]]> - - - outputs: - - + + + outputs: + + small ) ]]> - - - - - + + + + + + - - - func_get_arg - Return an item from the argument list - - - Description - - mixedfunc_get_arg - intarg_num - - - Returns the argument which is at the - arg_num'th offset into a user-defined - function's argument list. Function arguments are counted starting - from zero. func_get_arg will generate a - warning if called from outside of a function definition. - This function cannot be used directly as a function parameter. Instead, - its result may be assigned to a variable, which can then be passed to - the function. - - - If arg_num is greater than the number of - arguments actually passed, a warning will be generated and - func_get_arg will return &false;. - + + + func_get_arg + Return an item from the argument list + + + Description + + mixedfunc_get_arg + intarg_num + + + Returns the argument which is at the + arg_num'th offset into a user-defined + function's argument list. Function arguments are counted starting + from zero. func_get_arg will generate a + warning if called from outside of a function definition. + This function cannot be used directly as a function parameter. Instead, + its result may be assigned to a variable, which can then be passed to + the function. + + + If arg_num is greater than the number of + arguments actually passed, a warning will be generated and + func_get_arg will return &false;. + - ¬e.funcnoparam; + ¬e.funcnoparam; - - - + + + \n"; if ($numargs >= 2) { echo "Second argument is: " . func_get_arg(1) . "
\n"; } -} +} foo (1, 2, 3); ?> ]]> -
-
-
- - func_get_arg may be used in conjunction with - func_num_args and - func_get_args to allow user-defined - functions to accept variable-length argument lists. - -
-
+ + + + + func_get_arg may be used in conjunction with + func_num_args and + func_get_args to allow user-defined + functions to accept variable-length argument lists. + +
+
+ - - - func_get_args - - Returns an array comprising a function's argument list - - - - Description - - arrayfunc_get_args - - - - Returns an array in which each element is a copy of the corresponding - member of the current user-defined function's argument - list. func_get_args will generate a warning - if called from outside of a function definition. - This function cannot be used directly as a function parameter. Instead, - its result may be assigned to a variable, which can then be passed to - the function. - - - - This function returns a copy of the passed arguments only, and does not - account for default (non-passed) arguments. - - + + + func_get_args + Returns an array comprising a function's argument list + + + Description + + arrayfunc_get_args + + + + Returns an array in which each element is a copy of the corresponding + member of the current user-defined function's argument + list. func_get_args will generate a warning + if called from outside of a function definition. + This function cannot be used directly as a function parameter. Instead, + its result may be assigned to a variable, which can then be passed to + the function. + + + + This function returns a copy of the passed arguments only, and does not + account for default (non-passed) arguments. + + - ¬e.funcnoparam; + ¬e.funcnoparam; - - - + + + \n"; @@ -48,22 +46,22 @@ function foo() for ($i = 0; $i < $numargs; $i++) { echo "Argument $i is: " . $arg_list[$i] . "
\n"; } -} +} foo(1, 2, 3); ?> ]]> -
-
-
- - func_get_args may be used in conjunction - with func_num_args and - func_get_arg to allow user-defined functions - to accept variable-length argument lists. - -
-
+ + + + + func_get_args may be used in conjunction + with func_num_args and + func_get_arg to allow user-defined functions + to accept variable-length argument lists. + +
+
+ - - - func_num_args - - Returns the number of arguments passed to the function - - - - Description - - intfunc_num_args - - - - Returns the number of arguments passed into the current - user-defined function. func_num_args will - generate a warning if called from outside of a user-defined function. - This function cannot be used directly as a function parameter. Instead, - its result may be assigned to a variable, which can then be passed to - the function. - - - ¬e.funcnoparam; - - - - + + + func_num_args + Returns the number of arguments passed to the function + + + Description + + intfunc_num_args + + + + Returns the number of arguments passed into the current + user-defined function. func_num_args will + generate a warning if called from outside of a user-defined function. + This function cannot be used directly as a function parameter. Instead, + its result may be assigned to a variable, which can then be passed to + the function. + + + ¬e.funcnoparam; + + + + ]]> - - - - - func_num_args may be used in conjunction - with func_get_arg and - func_get_args to allow user-defined - functions to accept variable-length argument lists. - - - + + + + + func_num_args may be used in conjunction + with func_get_arg and + func_get_args to allow user-defined + functions to accept variable-length argument lists. + + + + - - - function_exists - - Return &true; if the given function has been defined - - - - Description - - boolfunction_exists - stringfunction_name - - - Checks the list of defined functions, both built-in (internal) and - user-defined, for function_name. &return.success; - - - - + + + function_exists + Return &true; if the given function has been defined + + + Description + + boolfunction_exists + stringfunction_name + + + Checks the list of defined functions, both built-in (internal) and + user-defined, for function_name. &return.success; + + + + ]]> - - - - - Note that a function name may exist even if the function itself - is unusable due to configuration or compiling options (with the - image functions being an example). - Also note that function_exists will return - &false; for constructs, such as include_once - and echo. - - - See also method_exists, - is_callable and - get_defined_functions. - - - + + + + + Note that a function name may exist even if the function itself + is unusable due to configuration or compiling options (with the + image functions being an example). + Also note that function_exists will return + &false; for constructs, such as include_once + and echo. + + + See also method_exists, + is_callable and + get_defined_functions. + + + + - - - get_defined_functions - - Returns an array of all defined functions - - - - Description - - arrayget_defined_functions - - - - This function returns an multidimensional array containing a list of - all defined functions, both built-in (internal) and user-defined. The - internal functions will be accessible via - $arr["internal"], and the user defined ones using - $arr["user"] (see example below). - - - - + + + get_defined_functions + Returns an array of all defined functions + + + Description + + arrayget_defined_functions + + + + This function returns an multidimensional array containing a list of + all defined functions, both built-in (internal) and user-defined. The + internal functions will be accessible via + $arr["internal"], and the user defined ones using + $arr["user"] (see example below). + + + + $id$data\n"; } @@ -36,11 +34,11 @@ $arr = get_defined_functions(); print_r($arr); ?> ]]> - - - Will output something along the lines of: - - + + + Will output something along the lines of: + + - - - - - See also - function_exists, - get_defined_vars and - get_defined_constants. - - - + + + + + See also + function_exists, + get_defined_vars and + get_defined_constants. + + + + - - - register_shutdown_function - - Register a function for execution on shutdown - - - - Description - - voidregister_shutdown_function - callbackfunction - mixedparameter - mixed... - - - Registers the function named by function to be - executed when script processing is complete. - - - Multiple calls to register_shutdown_function can be - made, and each will be called in the same order as they were registered. - If you call exit within one registered shutdown - function, processing will stop completely and no other registered - shutdown functions will be called. - - - In PHP 4.0.6 and earlier under Apache, - the registered shutdown functions are called after the request has been - completed (including sending any output buffers), so it is not possible - to send output to the browser using echo or - print, or retrieve the contents of any output - buffers using ob_get_contents. - Since PHP 4.1, the shutdown functions are called as the part of the - request so that it's possible to send the output from them. There is - currently no way to process the data with output buffering functions in - the shutdown function. - Shutdown function is called after closing all opened output buffers thus, - for example, its output will not be compressed if zlib.output_compression is - enabled. - - - As of PHP 4, it is possible to pass parameters to the shutdown function by - passing additional parameters to - register_shutdown_function. - - - - Typically undefined functions cause fatal errors in PHP, but when the - function called with - register_shutdown_function is undefined, an error - of level E_WARNING is generated instead. Also, - for reasons internal to PHP, this error will refer to - Unknown at line #0. - - - - - Working directory of the script can change inside the shutdown function - under some web servers, e.g. Apache. - - - - - Shutdown function is called during the script shutdown so headers are - always already sent. - - - - See also auto_append_file, - exit, and the section on - connection handling. - - - + + + register_shutdown_function + Register a function for execution on shutdown + + + Description + + voidregister_shutdown_function + callbackfunction + mixedparameter + mixed... + + + Registers the function named by function to be + executed when script processing is complete. + + + Multiple calls to register_shutdown_function can be + made, and each will be called in the same order as they were registered. + If you call exit within one registered shutdown + function, processing will stop completely and no other registered + shutdown functions will be called. + + + In PHP 4.0.6 and earlier under Apache, + the registered shutdown functions are called after the request has been + completed (including sending any output buffers), so it is not possible + to send output to the browser using echo or + print, or retrieve the contents of any output + buffers using ob_get_contents. + Since PHP 4.1, the shutdown functions are called as the part of the + request so that it's possible to send the output from them. There is + currently no way to process the data with output buffering functions in + the shutdown function. + Shutdown function is called after closing all opened output buffers thus, + for example, its output will not be compressed if zlib.output_compression is + enabled. + + + As of PHP 4, it is possible to pass parameters to the shutdown function by + passing additional parameters to + register_shutdown_function. + + + + Typically undefined functions cause fatal errors in PHP, but when the + function called with + register_shutdown_function is undefined, an error + of level E_WARNING is generated instead. Also, + for reasons internal to PHP, this error will refer to + Unknown at line #0. + + + + + Working directory of the script can change inside the shutdown function + under some web servers, e.g. Apache. + + + + + Shutdown function is called during the script shutdown so headers are + always already sent. + + + + See also auto_append_file, + exit, and the section on + connection handling. + + + + - - - register_tick_function - - Register a function for execution on each tick - - - - Description - - boolregister_tick_function - callbackfunction - mixedarg - mixed... - - - Registers the function named by func to be - executed when a tick is - called. Also, you may pass an array consisting of an object and a - method as the func. - - - - <function>register_tick_function</function> example - + + + register_tick_function + Register a function for execution on each tick + + + Description + + boolregister_tick_function + callbackfunction + mixedarg + mixed... + + + Registers the function named by func to be + executed when a tick is + called. Also, you may pass an array consisting of an object and a + method as the func. + + + + <function>register_tick_function</function> example + ]]> - - - - - - register_tick_function should not be used with - threaded web server modules. Ticks are not working in ZTS mode and may - crash your web server. - - - - See also declare and - unregister_tick_function. - - - + + + + + + register_tick_function should not be used with + threaded web server modules. Ticks are not working in ZTS mode and may + crash your web server. + + + + See also declare and + unregister_tick_function. + + + + - - - unregister_tick_function - - De-register a function for execution on each tick - - - - Description - - voidunregister_tick_function - stringfunction_name - - - De-registers the function named by function_name so it is - no longer executed when a tick is - called. - - + + + unregister_tick_function + De-register a function for execution on each tick + + + Description + + voidunregister_tick_function + stringfunction_name + + + De-registers the function named by function_name so it is + no longer executed when a tick is + called. + + +