函数名称:array_multi2single
函数原形:array array_multi2single(array)
实现功能:把一个多维数组的数值存放到一维数组中,不保存Key。
<?php
function array_multi2single($array)
{
static $result_array=array();
foreach($array as $value)
{
if(is_array($value))
{
array_multi2single($value);
}
else
$result_array[]=$value;
}
return $result_array;
}
//函数测试部分
$array=array("1"=>array("A","B","C",array("D","E")),"2"=>array("F","G","H","I"));
$array=array_multi2single($array);
echo "<h1>测试结果:</h1>";
foreach($array as $value)
{
echo "<h5>$value</h5>";
echo "<br>";
}
?>