reference/array/functions/array-walk.xml
d45ff7a3e78243470d1b7e5141d7ded022286d7f
...
...
@@ -172,6 +172,31 @@ c. fruit: apple
172
172
</screen>
173
173
</example>
174
174
</para>
175
+
<para>
176
+
<example>
177
+
<title><function>array_walk</function> example using anonymous function</title>
178
+
<programlisting role="php">
179
+
<![CDATA[
180
+
<?php
181
+
$elements = ['a', 'b', 'c'];
182
+

183
+
array_walk($elements, function ($value, $key) {
184
+
echo "{$key} => {$value}\n";
185
+
});
186
+

187
+
?>
188
+
]]>
189
+
</programlisting>
190
+
&example.outputs;
191
+
<screen role="php">
192
+
<![CDATA[
193
+
0 => a
194
+
1 => b
195
+
2 => c
196
+
]]>
197
+
</screen>
198
+
</example>
199
+
</para>
175
200
</refsect1>
176
201
<refsect1 role="seealso">
177
202
&reftitle.seealso;
178
203