- Use PEAR Coding Standards for OO examples

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@132591 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Derick Rethans 2003-06-20 06:55:46 +00:00
parent 22a94eefc4
commit f0212d661c

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.120 $ -->
<!-- $Revision: 1.121 $ -->
<chapter id="language.types">
<title>Types</title>
@ -2250,20 +2250,18 @@ function my_callback_function() {
call_user_func('my_callback_function');
// method callback examples
class my_class {
function my_callback_method() {
echo 'hello world!';
class MyClass {
function myCallbackMethod() {
echo 'Hello World!';
}
}
// static class method call without instantiating an object
call_user_func(array('my_class', 'my_callback_method'));
$obj = new my_class;
call_user_func(array(&$obj, 'my_callback_method')); // object method call
call_user_func(array('MyClass', 'myCallbackMethod'));
// object method call
$obj = new MyClass();
call_user_func(array(&$obj, 'myCallbackMethod'));
?>
]]>
</programlisting>