PHP - find records in one array that rea not found in another array?

Posted on 2014-01-24
Last Modified: 2014-01-24
I need to find records that are in the $remote_emails array that don't already exist in the $local_emails array.

Is there an easy way to do this?


				echo "Local Emails</br>";
				$local_emails = array('','','','','','');
                echo "</br>";
				echo "Remote Emails</br>";
                $remote_emails = array('', '','');
				//if email address from $remote_emails array does not exists in $local_emails array then echo it here

Open in new window

Question by:sabecs
LVL 58

Accepted Solution

Gary earned 500 total points
ID: 39807953

$difference = array_diff($remote_emails, $local_emails );


Author Closing Comment

ID: 39808179
Thanks Cathal.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now