note 112105 added to function.array-diff-assoc
| From: | MichaelRichey | Date: | Sat, 04 May 2013 01:43:39 +0000 |
| Subject: | note 112105 added to function.array-diff-assoc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194701@lists.php.net to get a copy of this message | ||
If you're looking for a true array_diff_assoc, comparing arrays to determine the difference
between two, finding missing values from both, you can use this along with array_merge.
$a = array('a'=>1,'b'=>2,'c'=>3);
$b = array('a'=>1,'b'=>2,'d'=>4);
print_r(array_diff_assoc($a,$b));
// returns:
array
(
[c] => 3
)
print_r(array_diff_assoc($b,$a));
// returns
array
(
[d] => 4
)
print_r(array_merge(array_diff_assoc($a,$b),array_diff_assoc($b,$a)));
// returns
array
(
[c] => 3
[d] => 4
)
----
Server IP: 69.147.83.199
Probable Submitter: 63.246.224.178
----
Manual Page -- http://php.net/manual/en/function.array-diff-assoc.php
Edit -- https://master.php.net/note/edit/112105
Del: integrated -- https://master.php.net/note/delete/112105/integrated
Del: useless -- https://master.php.net/note/delete/112105/useless
Del: bad code -- https://master.php.net/note/delete/112105/bad+code
Del: spam -- https://master.php.net/note/delete/112105/spam
Del: non-english -- https://master.php.net/note/delete/112105/non-english
Del: in docs -- https://master.php.net/note/delete/112105/in+docs
Del: other reasons-- https://master.php.net/note/delete/112105
Reject -- https://master.php.net/note/reject/112105
Search -- https://master.php.net/manage/user-notes.php