mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Documented new behaviour in 5.3 when called from outtermost scope in a file included from within a function.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@287566 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
bce4cbd8fe
commit
1901c7be3f
3 changed files with 162 additions and 0 deletions
|
@ -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 @@ foo (1, 2, 3);
|
|||
</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">
|
||||
|
|
|
@ -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>
|
||||
|
@ -94,6 +103,53 @@ Second argument is: 2<br />
|
|||
Argument 0 is: 1<br />
|
||||
Argument 1 is: 2<br />
|
||||
Argument 2 is: 3<br />
|
||||
]]>
|
||||
</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>
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in a new issue