reference/funchand/functions/func-get-args.xml
de42b5016e8d9cbfd245d70f65354a86f4e2f031
...
...
@@ -22,6 +22,11 @@
22
22
</para>
23
23
</refsect1>
24
24

25
+
<refsect1 role="parameters">
26
+
&reftitle.parameters;
27
+
&no.function.parameters;
28
+
</refsect1>
29
+

25
30
<refsect1 role="returnvalues">
26
31
&reftitle.returnvalues;
27
32
<para>
...
...
@@ -30,39 +35,6 @@
30
35
</para>
31
36
</refsect1>
32
37

33
-
<refsect1 role="changelog">
34
-
&reftitle.changelog;
35
-
<para>
36
-
<informaltable>
37
-
<tgroup cols="2">
38
-
<thead>
39
-
<row>
40
-
<entry>&Version;</entry>
41
-
<entry>&Description;</entry>
42
-
</row>
43
-
</thead>
44
-
<tbody>
45
-
<row>
46
-
<entry>5.3.0</entry>
47
-
<entry>
48
-
This function can now be used in parameter lists.
49
-
</entry>
50
-
</row>
51
-
<row>
52
-
<entry>5.3.0</entry>
53
-
<entry>
54
-
If this function is called from the outermost scope of a file
55
-
which has been included by calling <function>include</function>
56
-
or <function>require</function> from within a function in the
57
-
calling file, it now generates a warning and returns &false;.
58
-
</entry>
59
-
</row>
60
-
</tbody>
61
-
</tgroup>
62
-
</informaltable>
63
-
</para>
64
-
</refsect1>
65
-

66
38
<refsect1 role="errors">
67
39
&reftitle.errors;
68
40
<para>
...
...
@@ -81,13 +53,13 @@
81
53
function foo()
82
54
{
83
55
$numargs = func_num_args();
84
-
echo "Number of arguments: $numargs<br />\n";
56
+
echo "Number of arguments: $numargs \n";
85
57
if ($numargs >= 2) {
86
-
echo "Second argument is: " . func_get_arg(1) . "<br />\n";
58
+
echo "Second argument is: " . func_get_arg(1) . "\n";
87
59
}
88
60
$arg_list = func_get_args();
89
61
for ($i = 0; $i < $numargs; $i++) {
90
-
echo "Argument $i is: " . $arg_list[$i] . "<br />\n";
62
+
echo "Argument $i is: " . $arg_list[$i] . "\n";
91
63
}
92
64
}
93
65

...
...
@@ -98,62 +70,16 @@ foo(1, 2, 3);
98
70
&example.outputs;
99
71
<screen>
100
72
<![CDATA[
101
-
Number of arguments: 3<br />
102
-
Second argument is: 2<br />
103
-
Argument 0 is: 1<br />
104
-
Argument 1 is: 2<br />
105
-
Argument 2 is: 3<br />
73
+
Number of arguments: 3
74
+
Second argument is: 2
75
+
Argument 0 is: 1
76
+
Argument 1 is: 2
77
+
Argument 2 is: 3
106
78
]]>
107
79
</screen>
108
80
</example>
109
81
</para>
110
-
<para>
111
-
<example>
112
-
<title><function>func_get_args</function> example before and
113
-
after PHP 5.3</title>
114
-
<programlisting role="php">
115
-
<![CDATA[
116
-
test.php
117
-
<?php
118
-
function foo() {
119
-
include './fga.inc';
120
-
}
121
-

122
-
foo('First arg', 'Second arg');
123
-
?>
124
-

125
-
fga.inc
126
-
<?php
127
-

128
-
$args = func_get_args();
129
-
var_export($args);
130
82

131
-
?>
132
-
]]>
133
-
</programlisting>
134
-
<para>
135
-
Output previous to PHP 5.3:
136
-
</para>
137
-
<screen>
138
-
<![CDATA[
139
-
array (
140
-
0 => 'First arg',
141
-
1 => 'Second arg',
142
-
)
143
-
]]>
144
-
</screen>
145
-
<para>
146
-
Output in PHP 5.3 and later:
147
-
</para>
148
-
<screen>
149
-
<![CDATA[
150
-
Warning: func_get_args(): Called from the global scope - no function
151
-
context in /home/torben/Desktop/code/ml/fga.inc on line 3
152
-
false
153
-
]]>
154
-
</screen>
155
-
</example>
156
-
</para>
157
83
<para>
158
84
<example>
159
85
<title><function>func_get_args</function> example of byref and byval arguments</title>
...
...
@@ -178,13 +104,13 @@ byRef($arg);
178
104
?>
179
105
]]>
180
106
</programlisting>
181
-
&example.outputs;
107
+
&example.outputs;
182
108
<screen>
183
109
As passed : array (
184
110
0 => 'bar',
185
111
)
186
112
After change : array (
187
-
0 => 'bar',
113
+
0 => 'baz',
188
114
)
189
115
As passed : array (
190
116
0 => 'bar',
...
...
@@ -200,7 +126,7 @@ After change : array (
200
126

201
127
<refsect1 role="notes">
202
128
&reftitle.notes;
203
-
&note.funcnoparam;
129
+
&note.func-named-params;
204
130
&note.funcbyref;
205
131
<note>
206
132
<simpara>
...
...
@@ -214,6 +140,7 @@ After change : array (
214
140
&reftitle.seealso;
215
141
<para>
216
142
<simplelist>
143
+
<member><link linkend="functions.variable-arg-list"><literal>...</literal> syntax</link></member>
217
144
<member><function>func_get_arg</function></member>
218
145
<member><function>func_num_args</function></member>
219
146
<member><methodname>ReflectionFunctionAbstract::getParameters</methodname></member>
220
147