这段php代码通过foreach循环语句遍历数组并输出数组的所有元素
<html> <body> <?php $array = array( 1, 2, 3, 4, 5); foreach( $array as $value ) { echo "Value is $value <br />"; } ?> </body> </html>
输出结果如下:
Value is 1 Value is 2 Value is 3 Value is 4 Value is 5
这段php代码通过foreach循环语句遍历数组并输出数组的所有元素
<html> <body> <?php $array = array( 1, 2, 3, 4, 5); foreach( $array as $value ) { echo "Value is $value <br />"; } ?> </body> </html>
输出结果如下:
Value is 1 Value is 2 Value is 3 Value is 4 Value is 5