Using PHP, how can I match subscribers to users with these two arrays?
$subscribers
Array
(
[0] => stdClass Object
(
[meta_id] => 1
[email] => [email protected]
)
)
$users
Array
(
[0] => stdClass Object
(
[ID] => 1
[user_email] => [email protected]
)
[1] => stdClass Object
(
[ID] => 2
[user_email] => [email protected]
)
I thought this would do it...
<?php
foreach ( $users as $user ) {
if ( in_array( '[email protected]', $subscribers ) ) {
echo 'Matched user';
}
}