svn: /phpdoc/en/trunk/reference/funchand/functions/ func-get-arg.xml func-get-args.xml func-num-args.xml

From: Date: Sat, 22 Aug 2009 08:00:59 +0000
Subject: svn: /phpdoc/en/trunk/reference/funchand/functions/ func-get-arg.xml func-get-args.xml func-num-args.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-4730@lists.php.net to get a copy of this message
torben Sat, 22 Aug 2009 08:00:59 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=287566 Log: Documented new behaviour in 5.3 when called from outtermost scope in a file included from within a function. Changed paths: U phpdoc/en/trunk/reference/funchand/functions/func-get-arg.xml U phpdoc/en/trunk/reference/funchand/functions/func-get-args.xml U phpdoc/en/trunk/reference/funchand/functions/func-num-args.xml Modified: phpdoc/en/trunk/reference/funchand/functions/func-get-arg.xml =================================================================== --- phpdoc/en/trunk/reference/funchand/functions/func-get-arg.xml 2009-08-22 03:14:49 UTC (rev 287565) +++ phpdoc/en/trunk/reference/funchand/functions/func-get-arg.xml 2009-08-22 08:00:59 UTC (rev 287566) @@ -64,6 +64,15 @@ This function can now be used in parameter lists. </entry> </row> + <row> + <entry>5.3.0</entry> + <entry> + If this function is called from the outtermost scope of a file + which has been included by calling <function>include</function> + or <function>require</function> from within a function in the + calling file, it now generates a warning and returns &false;. + </entry> + </row> </tbody> </tgroup> </informaltable> @@ -102,6 +111,50 @@ </programlisting> </example> </para> + <para> + <example> + <title><function>func_get_arg</function> example before and + after PHP 5.3</title> + <programlisting role="php"> +<![CDATA[ +test.php +<?php +function foo() { + include './fga.inc'; +} + +foo('First arg', 'Second arg'); +?> + +fga.php +<?php + +$arg = func_get_arg1(1); +var_export($arg); + +?> +]]> + </programlisting> + <para> + Output previous to PHP 5.3: + </para> + <screen> +<![CDATA[ +'Second arg' +]]> + </screen> + <para> + Output in PHP 5.3 and later: + </para> + <screen> +<![CDATA[ +Warning: func_get_arg(): Called from the global scope - no function +context in /home/torben/Desktop/code/ml/fga.inc on line 3 +false +]]> + </screen> + </example> + </para> </refsect1> <refsect1 role="notes"> Modified: phpdoc/en/trunk/reference/funchand/functions/func-get-args.xml =================================================================== --- phpdoc/en/trunk/reference/funchand/functions/func-get-args.xml 2009-08-22 03:14:49 UTC (rev 287565) +++ phpdoc/en/trunk/reference/funchand/functions/func-get-args.xml 2009-08-22 08:00:59 UTC (rev 287566) @@ -48,6 +48,15 @@ This function can now be used in parameter lists. </entry> </row> + <row> + <entry>5.3.0</entry> + <entry> + If this function is called from the outtermost scope of a file + which has been included by calling <function>include</function> + or <function>require</function> from within a function in the + calling file, it now generates a warning and returns &false;. + </entry> + </row> </tbody> </tgroup> </informaltable> @@ -98,6 +107,53 @@ </screen> </example> </para> + <para> + <example> + <title><function>func_get_args</function> example before and + after PHP 5.3</title> + <programlisting role="php"> +<![CDATA[ +test.php +<?php +function foo() { + include './fga.inc'; +} + +foo('First arg', 'Second arg'); +?> + +fga.php +<?php + +$args = func_get_args(); +var_export($args); + +?> +]]> + </programlisting> + <para> + Output previous to PHP 5.3: + </para> + <screen> +<![CDATA[ +array ( + 0 => 'First arg', + 1 => 'Second arg', +) +]]> + </screen> + <para> + Output in PHP 5.3 and later: + </para> + <screen> +<![CDATA[ +Warning: func_get_args(): Called from the global scope - no function +context in /home/torben/Desktop/code/ml/fga.inc on line 3 +false +]]> + </screen> + </example> + </para> </refsect1> <refsect1 role="notes"> Modified: phpdoc/en/trunk/reference/funchand/functions/func-num-args.xml =================================================================== --- phpdoc/en/trunk/reference/funchand/functions/func-num-args.xml 2009-08-22 03:14:49 UTC (rev 287565) +++ phpdoc/en/trunk/reference/funchand/functions/func-num-args.xml 2009-08-22 08:00:59 UTC (rev 287566) @@ -48,10 +48,63 @@ This function can now be used in parameter lists. </entry> </row> + <row> + <entry>5.3.0</entry> + <entry> + If this function is called from the outtermost scope of a file + which has been included by calling <function>include</function> + or <function>require</function> from within a function in the + calling file, it now generates a warning and returns -1. + </entry> + </row> </tbody> </tgroup> </informaltable> </para> + <para> + <example> + <title><function>func_num_args</function> example before and + after PHP 5.3</title> + <programlisting role="php"> +<![CDATA[ +test.php +<?php +function foo() { + include './fga.inc'; +} + +foo('First arg', 'Second arg'); +?> + +fga.php +<?php + +$num_args = func_num_args(); +var_export($num_args); + +?> +]]> + </programlisting> + <para> + Output previous to PHP 5.3: + </para> + <screen> +<![CDATA[ +2 +]]> + </screen> + <para> + Output in PHP 5.3 and later: + </para> + <screen> +<![CDATA[ +Warning: func_num_args(): Called from the global scope - no function +context in /home/torben/Desktop/code/ml/fga.inc on line 3 +-1 +]]> + </screen> + </example> + </para> </refsect1> <refsect1 role="errors">

« previous php.doc.cvs (#4730) next »