aidan Sat Oct 9 01:35:31 2004 EDT
Modified files:
/phpdoc/en/language types.xml
Log:
Made the callback examples better. Should we create an entity for functions which
are not really functions, or an faq entry, or put them in a separate list on reserved
keywords?
http://cvs.php.net/diff.php/phpdoc/en/language/types.xml?r1=1.142&r2=1.143&ty=u
Index: phpdoc/en/language/types.xml
diff -u phpdoc/en/language/types.xml:1.142 phpdoc/en/language/types.xml:1.143
--- phpdoc/en/language/types.xml:1.142 Sat Sep 18 14:57:29 2004
+++ phpdoc/en/language/types.xml Sat Oct 9 01:35:29 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.142 $ -->
+<!-- $Revision: 1.143 $ -->
<chapter id="language.types">
<title>Types</title>
@@ -2305,24 +2305,25 @@
<programlisting role="php">
<![CDATA[
<?php
-
-// simple callback example
+// An example callback function
function my_callback_function() {
echo 'hello world!';
}
-call_user_func('my_callback_function');
-// method callback examples
+// An example callback method
class MyClass {
function myCallbackMethod() {
echo 'Hello World!';
}
}
-// static class method call without instantiating an object
+// Type 1: Simple callback
+call_user_func('my_callback_function');
+
+// Type 2: Static class method call
call_user_func(array('MyClass', 'myCallbackMethod'));
-// object method call
+// Type 3: Object method call
$obj = new MyClass();
call_user_func(array(&$obj, 'myCallbackMethod'));
?>