I want to loop an array variable in a for-each loop or any other way you suggest . and when looping if an array has two or more identical items/values the loop should skip the data and continue in with the next data .
$users = array ( array('user1', id , email),
array('user2', id , email),
array('user3', id , email),
array('user4', id , email)
foreach ($users as $key) {
// do something for each user
// if from arrays user1 , user2 , user3 , user4 there are some identical data ..
// skip that user and continue with another user
// then return results and number of users skipped
}
Example : if in array $users user1 has an email address/id same as user3 skip user3 and continue with user4
Hope you have got my point as I'm not so good in English
One simple way would be to just put all the email addresses that came up so far while looping through the array into another array, and check if the current email is in that already: