php二维数组如何利用循环遍历转一维数组
$twoDimensionalArray = array(
array("apple", "banana", "orange"),
array("car", "bike", "motorcycle"),
array("sun", "moon", "stars")
);
$oneDimensionalArray = array();
foreach ($twoDimensionalArray as $array) {
foreach ($array as $element) {
$oneDimensionalArray[] = $element;
}
}
print_r($oneDimensionalArray);
以上是编程学习网小编为您介绍的“php二维数组如何利用循环遍历转一维数组”的全面内容,想了解更多关于 php入门 内容,请继续关注编程基础学习网。