From 6aceff3a113f80e79fbfa18689bdc9ab369aefea Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Sat, 26 Oct 2002 06:58:16 +0000 Subject: [PATCH] - documentation on pseudo-types - "callback" pseudo-type added - changed usort proto to use callback (more will follow) git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@101396 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/types.xml | 130 +++++++++++++++++++++++----- reference/array/functions/usort.xml | 14 +-- 2 files changed, 114 insertions(+), 30 deletions(-) diff --git a/language/types.xml b/language/types.xml index b1125daa19..b5952f407b 100644 --- a/language/types.xml +++ b/language/types.xml @@ -1,5 +1,5 @@ - + Types @@ -77,27 +77,35 @@ + + This manual also introduces some + pseudo-types + for readability reasons: + + + + + + mixed + + + + + + number + + + + + + callback + + + + + - - - In this manual you'll often find mixed parameters. - This pseudo-type - indicates multiple possibilities for that parameter. - - - - The type of a variable is usually not set by the programmer; @@ -1827,7 +1835,89 @@ $var = NULL; See also is_null and unset. + + + + Pseudo-types used in this documentation + + + mixed + + mixed indicates that a parameter may accept multiple (but not + necesseraly all) types. + + + gettype for example will accept all PHP types, + while str_replace will accept strings and arrays. + + + + number + + number indicates that a parameter can be either + integer or float. + + + + + callback + + Some functions like call_user_function + or usort accept user defined + callback functions as a parameter. Callback functions can not only + be simple functions but also object methods including static class + methods. + + + A PHP function is simply passed by its name as a string. + + + A method of an instantiated object is passed as an array containing + an object as the element with index 0 and a method name as the + element with index 1. + + + Static class methods can also be passed without instantiating an + object of that class by passing the class name instead of an + object as the element with index 0. + + + + + + Callback function examples + + + +]]> + + + + + diff --git a/reference/array/functions/usort.xml b/reference/array/functions/usort.xml index f1c2db7024..16c2ee7c73 100644 --- a/reference/array/functions/usort.xml +++ b/reference/array/functions/usort.xml @@ -1,5 +1,5 @@ - + @@ -13,7 +13,7 @@ voidusort arrayarray - stringcmp_function + callbackcmp_function This function will sort an array by its values using a @@ -116,7 +116,7 @@ $fruits[2]: lemons ]]> - ¬e.func-callback; + @@ -165,13 +165,7 @@ c d </screen> </para> - <warning> - <para> - The underlying quicksort function in some C libraries (such as - on Solaris systems) may cause PHP to crash if the comparison - function does not return consistent values. - </para> - </warning> + <para> See also <function>uasort</function>, <function>uksort</function>, <function>sort</function>,