note 112717 added to function.array-intersect-uassoc
| From: | swapniltiwhane at gmail dot com | Date: | Tue, 16 Jul 2013 12:05:02 +0000 |
| Subject: | note 112717 added to function.array-intersect-uassoc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195642@lists.php.net to get a copy of this message | ||
$a = array(
array(
'id' => 15,
'name' => 'John',
'color' => 'red',
),
array(
'id' => 22,
'name' => 'Elise',
'color' => 'blue',
),
array(
'id' => 30,
'name' => 'Mark',
'color' => 'red',
),
);
$b = array(
array(
'id' => 15,
'name' => 'Nancy',
'color' => 'black',
),
array(
'id' => 20,
'name' => 'Elise',
'color' => 'blue',
),
array(
'id' => 30,
'name' => 'Mark',
'color' => 'red',
),
array(
'id' => 40,
'name' => 'John',
'color' => 'orange',
),
);
function compare_ids($a, $b)
{
return ((bool)($a['id'] - $b['id']));
}
print_r(array_intersect_uassoc($a, $b, "compare_ids"));
----
Server IP: 69.147.83.199
Probable Submitter: 203.115.126.178
----
Manual Page -- http://php.net/manual/en/function.array-intersect-uassoc.php
Edit -- https://master.php.net/note/edit/112717
Del: integrated -- https://master.php.net/note/delete/112717/integrated
Del: useless -- https://master.php.net/note/delete/112717/useless
Del: bad code -- https://master.php.net/note/delete/112717/bad+code
Del: spam -- https://master.php.net/note/delete/112717/spam
Del: non-english -- https://master.php.net/note/delete/112717/non-english
Del: in docs -- https://master.php.net/note/delete/112717/in+docs
Del: other reasons-- https://master.php.net/note/delete/112717
Reject -- https://master.php.net/note/reject/112717
Search -- https://master.php.net/manage/user-notes.php