note 73943 added to function.array-merge
| From: | php-general at lists dot php dot net | Date: | Fri, 16 Mar 2007 15:52:55 +0000 |
| Subject: | note 73943 added to function.array-merge | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124523@lists.php.net to get a copy of this message | ||
To jnothman at student dot usyd dot edu dot au
>>If you have a two dimensional array, or otherwise an array of arrays, the following may be
>>handy:
>> <?call_user_func_array('array_merge', $arr);?>
I avoid of using call_user_func, eval etc, at least, when they are outside of an expression; when
you're using a IDE, they can be quite interfering with things like code assist.
But, instead you can use the following, faster way:
<? $res = array_reduce('array_merge',$arr,array()); ?>
----
Server IP: 195.222.164.18
Probable Submitter: 213.134.196.50
----
Manual Page -- http://www.php.net/manual/en/function.array-merge.php
Edit -- https://master.php.net/note/edit/73943
Del: integrated -- https://master.php.net/note/delete/73943/integrated
Del: useless -- https://master.php.net/note/delete/73943/useless
Del: bad code -- https://master.php.net/note/delete/73943/bad+code
Del: spam -- https://master.php.net/note/delete/73943/spam
Del: non-english -- https://master.php.net/note/delete/73943/non-english
Del: in docs -- https://master.php.net/note/delete/73943/in+docs
Del: other reasons-- https://master.php.net/note/delete/73943
Reject -- https://master.php.net/note/reject/73943
Search -- https://master.php.net/manage/user-notes.php