note 60908 added to function.array-merge
| From: | rick-nospam at wzoeterwoude dot net | Date: | Thu, 19 Jan 2006 23:06:07 +0000 |
| Subject: | note 60908 added to function.array-merge | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102125@lists.php.net to get a copy of this message | ||
By combining both array_unique and array_merge, you could get a unique merged arrays ;-)
<?php
$aFoo = array('1', '2', '3', 'a');
$aBar = array('a', 'b', '3', '4');
$aMergedFooBar = array_merge($aFoo, $aBar);
$aMergedUniqueFooBar = array_unique($aMergedFooBar);
print_r($aMergedFooBar);
print_r($aMergedUniqueFooBar);
?>
Will output:
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => a
[4] => a
[5] => b
[6] => 3
[7] => 4
)
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => a
[5] => b
[7] => 4
)
----
Server IP: 194.109.193.119
Probable Submitter: 213.84.99.45
----
Manual Page -- http://www.php.net/manual/en/function.array-merge.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60908
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60908&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60908&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60908&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60908&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60908&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60908&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60908&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60908&report=yes
Search -- http://master.php.net/manage/user-notes.php