svn: /phpdoc/en/trunk/ language-snippets.ent reference/funchand/functions/func-get-arg.xml reference/funchand/functions/func-get-args.xml
| From: | Richard Quadling | Date: | Wed, 20 Apr 2011 12:59:20 +0000 |
| Subject: | svn: /phpdoc/en/trunk/ language-snippets.ent reference/funchand/functions/func-get-arg.xml reference/funchand/functions/func-get-args.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-7983@lists.php.net to get a copy of this message | ||
rquadling Wed, 20 Apr 2011 12:59:20 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=310390
Log:
Note that func_get_arg() and func_get_args() will return current value for byref arguments.
Changed paths:
U phpdoc/en/trunk/language-snippets.ent
U phpdoc/en/trunk/reference/funchand/functions/func-get-arg.xml
U phpdoc/en/trunk/reference/funchand/functions/func-get-args.xml
Modified: phpdoc/en/trunk/language-snippets.ent
===================================================================
--- phpdoc/en/trunk/language-snippets.ent 2011-04-20 12:59:18 UTC (rev 310389)
+++ phpdoc/en/trunk/language-snippets.ent 2011-04-20 12:59:20 UTC (rev 310390)
@@ -39,6 +39,9 @@
with functions such as <function>call_user_func</function> and
<function>call_user_func_array</function> will not be
called if there is an uncaught exception thrown in a previous
callback.</para></note>'>
+<!ENTITY note.funcbyref '<note xmlns="http://docbook.org/ns/docbook"><para>If
the arguments are passed by reference,
+any changes to the arguments will be reflected in the values returned by this
function.</para></note>'>
+
<!ENTITY note.funcnoparam '<note xmlns="http://docbook.org/ns/docbook"><para>Because
this function depends on the
current scope to determine parameter details, it cannot be used as a
function parameter in versions prior to 5.3.0. If this value must be passed, the results should be
assigned
Modified: phpdoc/en/trunk/reference/funchand/functions/func-get-arg.xml
===================================================================
--- phpdoc/en/trunk/reference/funchand/functions/func-get-arg.xml 2011-04-20 12:59:18 UTC (rev
310389)
+++ phpdoc/en/trunk/reference/funchand/functions/func-get-arg.xml 2011-04-20 12:59:20 UTC (rev
310390)
@@ -155,11 +155,47 @@
</screen>
</example>
</para>
+
+ <para>
+ <example>
+ <title><function>func_get_arg</function> example of byref and byval
arguments</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function byVal($arg) {
+ echo 'As passed : ', var_export(func_get_arg(0)), PHP_EOL;
+ $arg = 'baz';
+ echo 'After change : ', var_export(func_get_arg(0)), PHP_EOL;
+}
+
+function byRef(&$arg) {
+ echo 'As passed : ', var_export(func_get_arg(0)), PHP_EOL;
+ $arg = 'baz';
+ echo 'After change : ', var_export(func_get_arg(0)), PHP_EOL;
+}
+
+$arg = 'bar';
+byVal($arg);
+byRef($arg);
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+As passed : 'bar'
+After change : 'bar'
+As passed : 'bar'
+After change : 'baz'
+ </screen>
+ </example>
+ </para>
+
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
¬e.funcnoparam;
+ ¬e.funcbyref;
<note>
<simpara>
This function returns a copy of the passed arguments only, and does not
Modified: phpdoc/en/trunk/reference/funchand/functions/func-get-args.xml
===================================================================
--- phpdoc/en/trunk/reference/funchand/functions/func-get-args.xml 2011-04-20 12:59:18 UTC (rev
310389)
+++ phpdoc/en/trunk/reference/funchand/functions/func-get-args.xml 2011-04-20 12:59:20 UTC (rev
310390)
@@ -154,11 +154,54 @@
</screen>
</example>
</para>
+ <para>
+ <example>
+ <title><function>func_get_args</function> example of byref and byval
arguments</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function byVal($arg) {
+ echo 'As passed : ', var_export(func_get_args()), PHP_EOL;
+ $arg = 'baz';
+ echo 'After change : ', var_export(func_get_args()), PHP_EOL;
+}
+
+function byRef(&$arg) {
+ echo 'As passed : ', var_export(func_get_args()), PHP_EOL;
+ $arg = 'baz';
+ echo 'After change : ', var_export(func_get_args()), PHP_EOL;
+}
+
+$arg = 'bar';
+byVal($arg);
+byRef($arg);
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+As passed : array (
+ 0 => 'bar',
+)
+After change : array (
+ 0 => 'bar',
+)
+As passed : array (
+ 0 => 'bar',
+)
+After change : array (
+ 0 => 'baz',
+)
+ </screen>
+ </example>
+ </para>
+
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
¬e.funcnoparam;
+ ¬e.funcbyref;
<note>
<simpara>
This function returns a copy of the passed arguments only, and does not