From 7164175020eb32a84e8c2e0221adf3a5d14a5c82 Mon Sep 17 00:00:00 2001 From: Etienne Kneuss Date: Fri, 8 Feb 2008 22:17:25 +0000 Subject: [PATCH] Document special callbacks git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@252539 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/types.xml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/language/types.xml b/language/types.xml index 3b1bf9befb..be55f4a72d 100644 --- a/language/types.xml +++ b/language/types.xml @@ -1,5 +1,5 @@ - + Types @@ -2382,7 +2382,8 @@ $var = NULL; A PHP function is simply passed by its name as a string. You can - pass any built-in or user defined function with the exception of + pass any built-in or user defined function. Note that language + constructs like array, echo, empty, @@ -2390,8 +2391,8 @@ $var = NULL; exit, isset, list, - print and - unset. + print or + unset cannot be called using a callback. A method of an instantiated object is passed as an array containing @@ -2443,6 +2444,20 @@ call_user_func(array($obj, 'myCallbackMethod')); // Type 4: Static class method call (As of PHP 5.2.3) call_user_func('MyClass::myCallbackMethod'); +// Type 5: Relative static class method call (As of PHP 5.3.0) +class A { + public static function who() { + echo "A\n"; + } +} + +class B extends A { + public static function who() { + echo "B\n"; + } +} + +call_user_func(array('B', 'parent::who')); // A ?> ]]>