$val){...}}".">
PHP traversal refers to traversing an array, which means taking out the elements in the array. PHP traversal statements such as "foreach($arr_m as $value){foreach($value AS $key => $val){ ...}}".
Recommended: "PHP Video Tutorial"
php traversal refers to traversing the array
That's it Take out the elements from the array. .
For example
$arr = array( 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4 ); foreach($a AS $k => $v) { echo $k.'的值是'.$v; }
This is a 2-dimensional array, and a double-layer loop must be used. .
If you want to output more content, you can try my modified code.
23,'name'=>'小红','age'=>23), array('id'=>15,'name'=>'小白','age'=>21), array('id'=>12,'name'=>'小黑','age'=>31), array('id'=>2,'name'=>'小二','age'=>31) ); $arr_id = array(); $arr_age = array(); foreach($arr_m as $value) { foreach($value AS $key => $val) { echo $key.'是'.$val .'
'; } echo ''; } ?>
The above is the detailed content of What does php traversal mean?. For more information, please follow other related articles on the PHP Chinese website!