mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Add new example ("class::method" as valid callback)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@251268 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
e0c25b85eb
commit
257c6a22dd
1 changed files with 7 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.193 $ -->
|
||||
<!-- $Revision: 1.194 $ -->
|
||||
<chapter xml:id="language.types" xmlns="http://docbook.org/ns/docbook">
|
||||
<title>Types</title>
|
||||
|
||||
|
@ -2417,6 +2417,7 @@ $var = NULL;
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// An example callback function
|
||||
function my_callback_function() {
|
||||
echo 'hello world!';
|
||||
|
@ -2424,7 +2425,7 @@ function my_callback_function() {
|
|||
|
||||
// An example callback method
|
||||
class MyClass {
|
||||
function myCallbackMethod() {
|
||||
static function myCallbackMethod() {
|
||||
echo 'Hello World!';
|
||||
}
|
||||
}
|
||||
|
@ -2438,6 +2439,10 @@ call_user_func(array('MyClass', 'myCallbackMethod'));
|
|||
// Type 3: Object method call
|
||||
$obj = new MyClass();
|
||||
call_user_func(array($obj, 'myCallbackMethod'));
|
||||
|
||||
// Type 4: Static class method call (As of PHP 5.2.3)
|
||||
call_user_func('MyClass::myCallbackMethod');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
Loading…
Reference in a new issue