note 114605 added to function.array-diff
| From: | MD.ABUSAYEM= | Date: | Tue, 11 Mar 2014 14:21:17 +0000 |
| Subject: | note 114605 added to function.array-diff | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198861@lists.php.net to get a copy of this message | ||
//array_diff function compare first array against all of the array and return the elements with
index that are not present in either of the array.
<?php
$array1 = array("a" => "green", "red",
"c"=>"blue", "red","cyan",2,3,"white");
$array2 = array("b" => "green", "yellow", "red");
$array3 = array("b" => "green", "yellow", "white",4);
$array4 = array("b" => "green", "yellow", "blue",2);
$result = array_diff($array1, $array2,$array3,$array4);
echo "<pre>";
print_r($result);
?>
//outputs
Array
(
[3] => cyan
[5] => 3
)
----
Server IP: 72.52.91.14
Probable Submitter: 180.149.31.186
----
Manual Page -- http://php.net/manual/en/function.array-diff.php
Edit -- https://master.php.net/note/edit/114605
Del: integrated -- https://master.php.net/note/delete/114605/integrated
Del: useless -- https://master.php.net/note/delete/114605/useless
Del: bad code -- https://master.php.net/note/delete/114605/bad+code
Del: spam -- https://master.php.net/note/delete/114605/spam
Del: non-english -- https://master.php.net/note/delete/114605/non-english
Del: in docs -- https://master.php.net/note/delete/114605/in+docs
Del: other reasons-- https://master.php.net/note/delete/114605
Reject -- https://master.php.net/note/reject/114605
Search -- https://master.php.net/manage/user-notes.php