cvs: phpdoc /en/reference/funchand/functions call-user-func.xml

From: Date: Fri, 06 Aug 2004 22:16:45 +0000
Subject: cvs: phpdoc /en/reference/funchand/functions call-user-func.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969362792@lists.php.net to get a copy of this message
vrana Fri Aug 6 18:16:45 2004 EDT Modified files: /phpdoc/en/reference/funchand/functions call-user-func.xml Log: Parameters are not passed by reference (bug #24931) http://cvs.php.net/diff.php/phpdoc/en/reference/funchand/functions/call-user-func.xml?r1=1.10&r2=1.11&ty=u Index: phpdoc/en/reference/funchand/functions/call-user-func.xml diff -u phpdoc/en/reference/funchand/functions/call-user-func.xml:1.10 phpdoc/en/reference/funchand/functions/call-user-func.xml:1.11 --- phpdoc/en/reference/funchand/functions/call-user-func.xml:1.10 Thu Jan 15 07:42:26 2004 +++ phpdoc/en/reference/funchand/functions/call-user-func.xml Fri Aug 6 18:16:44 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <!-- splitted from ./en/functions/funchand.xml, last change in rev 1.1 --> <refentry id="function.call-user-func"> <refnamediv> @@ -41,17 +41,15 @@ Object methods may also be invoked statically using this function by passing <literal>array($objectname, $methodname)</literal> to the <parameter>function</parameter> parameter. - </para> - <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php class myclass { - function say_hello() - { - echo "Hello!\n"; - } + function say_hello() + { + echo "Hello!\n"; + } } $classname = "myclass"; @@ -62,6 +60,31 @@ </programlisting> </informalexample> </para> + <note> + <para> + Note that the parameters for <function>call_user_func</function> are not + passed by reference. + <informalexample> + <programlisting role="php"> +<![CDATA[ +<?php +function increment(&$var) +{ + $var++; +} + +$a = 0; +call_user_func('increment', $a); +echo $a; // 0 + +call_user_func_array('increment', array(&$a)); // You can use this instead +echo $a; // 1 +?> +]]> + </programlisting> + </informalexample> + </para> + </note> <para> See also: <function>is_callable</function>, and

« previous php.doc (#969362792) next »