mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Document special callbacks
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@252539 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
dabad796d9
commit
7164175020
1 changed files with 19 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.194 $ -->
|
||||
<!-- $Revision: 1.195 $ -->
|
||||
<chapter xml:id="language.types" xmlns="http://docbook.org/ns/docbook">
|
||||
<title>Types</title>
|
||||
|
||||
|
@ -2382,7 +2382,8 @@ $var = NULL;
|
|||
</para>
|
||||
<para>
|
||||
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
|
||||
<function>array</function>,
|
||||
<function>echo</function>,
|
||||
<function>empty</function>,
|
||||
|
@ -2390,8 +2391,8 @@ $var = NULL;
|
|||
<function>exit</function>,
|
||||
<function>isset</function>,
|
||||
<function>list</function>,
|
||||
<function>print</function> and
|
||||
<function>unset</function>.
|
||||
<function>print</function> or
|
||||
<function>unset</function> cannot be called using a callback.
|
||||
</para>
|
||||
<para>
|
||||
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
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
Loading…
Reference in a new issue