note 78550 added to ref.array
| From: | HayleyWatson at osu1 dot php dot net | Date: | Wed, 17 Oct 2007 03:26:17 +0000 |
| Subject: | note 78550 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131443@lists.php.net to get a copy of this message | ||
Yet Another flatten-multidimensional-array function. For numerically-indexed arrays.
<?php
function flatten_array($array)
{
if(!is_array($array)) return array($array);
return call_user_func_array('array_merge', array_map('flatten_array', $array));
}
?>
$t1 = array(0,1,2,array(3,4),5,array(array(6),array(7,8),9));
print_r(flatten_array($t1));
?>
----
Server IP: 203.89.181.186
Probable Submitter: 60.234.168.92
----
Manual Page -- http://www.php.net/manual/en/ref.array.php
Edit -- https://master.php.net/note/edit/78550
Del: integrated -- https://master.php.net/note/delete/78550/integrated
Del: useless -- https://master.php.net/note/delete/78550/useless
Del: bad code -- https://master.php.net/note/delete/78550/bad+code
Del: spam -- https://master.php.net/note/delete/78550/spam
Del: non-english -- https://master.php.net/note/delete/78550/non-english
Del: in docs -- https://master.php.net/note/delete/78550/in+docs
Del: other reasons-- https://master.php.net/note/delete/78550
Reject -- https://master.php.net/note/reject/78550
Search -- https://master.php.net/manage/user-notes.php