reference/funchand/functions/func-get-arg.xml
de42b5016e8d9cbfd245d70f65354a86f4e2f031
...
...
@@ -10,7 +10,7 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>mixed</type><methodname>func_get_arg</methodname>
13
-
<methodparam><type>int</type><parameter>arg_num</parameter></methodparam>
13
+
<methodparam><type>int</type><parameter>position</parameter></methodparam>
14
14
</methodsynopsis>
15
15
<para>
16
16
Gets the specified argument from a user-defined function's argument list.
...
...
@@ -27,7 +27,7 @@
27
27
<para>
28
28
<variablelist>
29
29
<varlistentry>
30
-
<term><parameter>arg_num</parameter></term>
30
+
<term><parameter>position</parameter></term>
31
31
<listitem>
32
32
<para>
33
33
The argument offset. Function arguments are counted starting from
...
...
@@ -46,44 +46,11 @@
46
46
</para>
47
47
</refsect1>
48
48

49
-
<refsect1 role="changelog">
50
-
&reftitle.changelog;
51
-
<para>
52
-
<informaltable>
53
-
<tgroup cols="2">
54
-
<thead>
55
-
<row>
56
-
<entry>&Version;</entry>
57
-
<entry>&Description;</entry>
58
-
</row>
59
-
</thead>
60
-
<tbody>
61
-
<row>
62
-
<entry>5.3.0</entry>
63
-
<entry>
64
-
This function can now be used in parameter lists.
65
-
</entry>
66
-
</row>
67
-
<row>
68
-
<entry>5.3.0</entry>
69
-
<entry>
70
-
If this function is called from the outermost scope of a file
71
-
which has been included by calling <function>include</function>
72
-
or <function>require</function> from within a function in the
73
-
calling file, it now generates a warning and returns &false;.
74
-
</entry>
75
-
</row>
76
-
</tbody>
77
-
</tgroup>
78
-
</informaltable>
79
-
</para>
80
-
</refsect1>
81
-

82
49
<refsect1 role="errors">
83
50
&reftitle.errors;
84
51
<para>
85
52
Generates a warning if called from outside of a user-defined function, or
86
-
if <parameter>arg_num</parameter> is greater than the number of arguments
53
+
if <parameter>position</parameter> is greater than the number of arguments
87
54
actually passed.
88
55
</para>
89
56
</refsect1>
...
...
@@ -99,58 +66,21 @@
99
66
function foo()
100
67
{
101
68
$numargs = func_num_args();
102
-
echo "Number of arguments: $numargs<br />\n";
69
+
echo "Number of arguments: $numargs\n";
103
70
if ($numargs >= 2) {
104
-
echo "Second argument is: " . func_get_arg(1) . "<br />\n";
71
+
echo "Second argument is: " . func_get_arg(1) . "\n";
105
72
}
106
73
}
107
74

108
-
foo (1, 2, 3);
75
+
foo(1, 2, 3);
109
76
?>
110
77
]]>
111
78
</programlisting>
112
-
</example>
113
-
</para>
114
-
<para>
115
-
<example>
116
-
<title><function>func_get_arg</function> example before and
117
-
after PHP 5.3</title>
118
-
<programlisting role="php">
119
-
<![CDATA[
120
-
test.php
121
-
<?php
122
-
function foo() {
123
-
include './fga.inc';
124
-
}
125
-

126
-
foo('First arg', 'Second arg');
127
-
?>
128
-

129
-
fga.inc
130
-
<?php
131
-

132
-
$arg = func_get_arg(1);
133
-
var_export($arg);
134
-

135
-
?>
136
-
]]>
137
-
</programlisting>
138
-
<para>
139
-
Output previous to PHP 5.3:
140
-
</para>
79
+
&example.outputs;
141
80
<screen>
142
81
<![CDATA[
143
-
'Second arg'
144
-
]]>
145
-
</screen>
146
-
<para>
147
-
Output in PHP 5.3 and later:
148
-
</para>
149
-
<screen>
150
-
<![CDATA[
151
-
Warning: func_get_arg(): Called from the global scope - no function
152
-
context in /home/torben/Desktop/code/ml/fga.inc on line 3
153
-
false
82
+
Number of arguments: 3
83
+
Second argument is: 2
154
84
]]>
155
85
</screen>
156
86
</example>
...
...
@@ -180,10 +110,10 @@ byRef($arg);
180
110
?>
181
111
]]>
182
112
</programlisting>
183
-
&example.outputs;
113
+
&example.outputs;
184
114
<screen>
185
115
As passed : 'bar'
186
-
After change : 'bar'
116
+
After change : 'baz'
187
117
As passed : 'bar'
188
118
After change : 'baz'
189
119
</screen>
...
...
@@ -194,7 +124,7 @@ After change : 'baz'
194
124

195
125
<refsect1 role="notes">
196
126
&reftitle.notes;
197
-
&note.funcnoparam;
127
+
&note.func-named-params;
198
128
&note.funcbyref;
199
129
<note>
200
130
<simpara>
...
...
@@ -208,7 +138,7 @@ After change : 'baz'
208
138
&reftitle.seealso;
209
139
<para>
210
140
<simplelist>
211
-
<member><link linkend="functions.variable-arg-list.new"><literal>...</literal> syntax in PHP 5.6+</link></member>
141
+
<member><link linkend="functions.variable-arg-list"><literal>...</literal> syntax</link></member>
212
142
<member><function>func_get_args</function></member>
213
143
<member><function>func_num_args</function></member>
214
144
</simplelist>
...
...
@@ -216,7 +146,6 @@ After change : 'baz'
216
146
</refsect1>
217
147

218
148
</refentry>
219
-

220
149
<!-- Keep this comment at the end of the file
221
150
Local variables:
222
151
mode: sgml
223
152