The 'as' operator in PHP
7 answers
Take an example:
foreach ($array as $value) {}
It means
for each item (of
$array) defined as$value...
In other words, this means that the elements of the array will be extracted inside the loop as $value. Note that you can also specify this syntax:
foreach ($array as $key => $value) {}
In both cases, vars $keyand $valuewill exist inside foreachand will correspond to the "current" element of the array.
+12
http://php.net/manual/en/control-structures.foreach.php
foreach (array_expression as $value)
statement
, array_expression.
$value, ( ).
+2