pollita Tue Jan 28 16:06:51 2003 EDT Modified files: /phpdoc/en/reference/funchand/functions call-user-func.xml Log: Added paragraph and example explaining ability to call object methods. Index: phpdoc/en/reference/funchand/functions/call-user-func.xml diff -u phpdoc/en/reference/funchand/functions/call-user-func.xml:1.3 phpdoc/en/reference/funchand/functions/call-user-func.xml:1.4 --- phpdoc/en/reference/funchand/functions/call-user-func.xml:1.3 Sat Oct 26 16:40:42 2002 +++ phpdoc/en/reference/funchand/functions/call-user-func.xml Tue Jan 28 16:06:51 +2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/funchand.xml, last change in rev 1.1 --> <refentry id="function.call-user-func"> <refnamediv> @@ -28,6 +28,28 @@ } call_user_func ('barber', "mushroom"); call_user_func ('barber', "shave"); +]]> + </programlisting> + </informalexample> + </para> + <para> + Object methods may also be invoked statically using this function + by passing <literal>array($objectname, $methodname)</literal> to + the <parameter>function</parameter> parameter. + <informalexample> + <programlisting role="php"> +<![CDATA[ +<?php +class myclass { + function say_hello() { + print "Hello!\n"; + } +} + +$classname = "myclass"; + +call_user_func(array($classname,'say_hello')); +?> ]]> </programlisting> </informalexample>
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php