diff --git a/reference/funchand/functions/call-user-func-array.xml b/reference/funchand/functions/call-user-func-array.xml index 2b33b66169..36c75a2f31 100644 --- a/reference/funchand/functions/call-user-func-array.xml +++ b/reference/funchand/functions/call-user-func-array.xml @@ -1,5 +1,5 @@ - + @@ -20,9 +20,12 @@ function, with the parameters in paramarr. For example: + + ]]> diff --git a/reference/funchand/functions/call-user-func.xml b/reference/funchand/functions/call-user-func.xml index 56fbba4a91..7072be857f 100644 --- a/reference/funchand/functions/call-user-func.xml +++ b/reference/funchand/functions/call-user-func.xml @@ -1,5 +1,5 @@ - + @@ -20,14 +20,18 @@ Call a user defined function given by the function parameter. Take the following: + + ]]> @@ -36,6 +40,8 @@ call_user_func ('barber', "shave"); Object methods may also be invoked statically using this function by passing array($objectname, $methodname) to the function parameter. + + - + @@ -27,23 +27,31 @@ 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 @@ -51,6 +59,7 @@ echo $newfunc(2,M_E)."\n"; ]]> - - 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 + the mango -// [1] => a mango -// [2] => that mango -// [3] => this mango -// ) +/* +outputs: +Array +( + [0] => the mango + [1] => a mango + [2] => that mango + [3] => this mango +) +*/ // an array of strings ordered from shorter to longer $sv = array("small","larger","a big string","it is a string thing"); print_r($sv); -// outputs: -// Array -// ( -// [0] => small -// [1] => larger -// [2] => a big string -// [3] => it is a string thing -// ) +/* +outputs: +Array +( + [0] => small + [1] => larger + [2] => a big string + [3] => it is a string thing +) +*/ // sort it from longer to shorter usort($sv, create_function('$a,$b','return strlen($b) - strlen($a);')); print_r($sv); -// outputs: -// Array -// ( -// [0] => it is a string thing -// [1] => a big string -// [2] => larger -// [3] => small -// ) +/* +outputs: +Array +( + [0] => it is a string thing + [1] => a big string + [2] => larger + [3] => small +) +*/ +?> ]]> - - + + diff --git a/reference/funchand/functions/function-exists.xml b/reference/funchand/functions/function-exists.xml index c6d8b76ba8..6db8b12663 100644 --- a/reference/funchand/functions/function-exists.xml +++ b/reference/funchand/functions/function-exists.xml @@ -1,5 +1,5 @@ - + @@ -17,17 +17,23 @@ Checks the list of defined functions, both built-in (internal) and user-defined, for function_name. &return.success; + + \n"; + echo "IMAP functions are available.
\n"; } else { - echo "IMAP functions are not available.
\n"; + echo "IMAP functions are not available.
\n"; } +?> ]]>
+
+ 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). diff --git a/reference/funchand/functions/get-defined-functions.xml b/reference/funchand/functions/get-defined-functions.xml index 5dd89cea14..3e62ff2f54 100644 --- a/reference/funchand/functions/get-defined-functions.xml +++ b/reference/funchand/functions/get-defined-functions.xml @@ -1,5 +1,5 @@ - + @@ -20,9 +20,12 @@ internal functions will be accessible via $arr["internal"], and the user defined ones using $arr["user"] (see example below). + + $id$data\n"; } @@ -30,14 +33,13 @@ function myrow($id, $data) { $arr = get_defined_functions(); print_r($arr); +?> ]]> - - - - - Will output something along the lines of: - - + + + Will output something along the lines of: + + - +