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:
Felipe Pena 2008-01-24 17:46:12 +00:00
parent e0c25b85eb
commit 257c6a22dd

View file

@ -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>