What is a simple mode, in PHP, to remove all the sub arrays of a multidimensional array? What I want is to remove all the开发者_如何学Go sub arrays but the top one...
Thanks, titel
foreach($array as $k => $a) {
if (is_array($a)) { unset($array[$k]); }
}
Like this?
function FlattenCallback($Value) { return !is_array($Value); }
$OneDimension = array_filter($MultiDimension, 'FlattenCallback');
精彩评论