note 60908 deleted from function.array-merge by jome
| From: | jome@php.net | Date: | Thu, 19 Jan 2006 23:31:46 +0000 |
| Subject: | note 60908 deleted from function.array-merge by jome | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-102126@lists.php.net to get a copy of this message | ||
Note Submitter: rick-nospam at wzoeterwoude dot net
Reason: useless
----
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
)