How should I remove data from array?
<p><strong>Question</strong></p>

<p>Basically I want to send reminder emails to the people who haven't accepted the challenge yet. From <strong>challenges</strong> table I get the emails who have been challenged and then from <strong>a_challenges</strong> table I get the emails (usernames) who have accepted the challenge.</p>

<p><strong>Problem</strong></p>

<p>I want to basically remove the email addresses which are in the <strong>a_challenges</strong> table from the array coming from <strong>challenges</strong> table as those people have already accepted the challenge so i don't want to send them an reminder email. Any help will be appreciated.</p>

<p><strong>Code</strong></p>

<pre><code>&lt;?php
    require_once('includes/dbConnector.php');
    $dbCon = new dbConnector();//define the DB connection
    $query_challenges = "Select distinct * from challenges";//query to fetch records from challenges table like usernames who have been challenged
    //echo $query_challenges;
    $result_challenges = $dbCon-&gt;query($query_challenges);//execute query


    //start while loop to fetch the records
    while($row_tr = $dbCon-&gt;fetchArray($result_challenges)){
        $t_name = $row_tr['t_name'];
        $c_emails = $row_tr['c_emails'];
        echo "&lt;br /&gt;&lt;br /&gt;".$t_name."&lt;br /&gt;&lt;br /&gt;";

            $query_a_challenges = "Select * from a_challenges where t_name='".$t_name."'";//query to fetch records from a_challenges table like usernames who have accepted the challenge, etc
            //echo $query_a_challenges;
            $result_a_challenges = $dbCon-&gt;query($query_a_challenges);//execute query
            while($row_a_challenges = $dbCon-&gt;fetchArray($result_a_challenges)){
                echo "Accepted==&gt; ". $row_a_challenges['full_name']." -- ";
                echo $row_a_challenges['username']."&lt;br /&gt;&lt;br /&gt;";
            }//end while a_challenges..

        //echo $c_emails."&lt;br /&gt;&lt;br /&gt;";
        $c_emails = explode(',', $c_emails);
        for($i=0; $i&lt;count($c_emails); $i++){
            echo $c_emails[$i]."&lt;br /&gt;";
        }//end for
    }//end while challenges..
?&gt;
</code></pre>

<p><strong>Actual Output</strong></p>

<pre><code>Team==&gt; AGS Larger Lads

Accepted==&gt; Donald -- donald@example.com

Accepted==&gt; David -- david@example.com

Accepted==&gt; Sean -- Sean@example.com
</code></pre>

<p><em><strong>Send email to below mentioned address:</em></strong></p>

<pre><code>byrne@example.com
neil@example.com
brendan@example.com
Sean@example.com
donald@example.com
saunders@example.com
david@example.com
</code></pre>

<p><strong>Expected Output</strong></p>

<pre><code>Team==&gt; AGS Larger Lads

Accepted==&gt; Donald -- donald@example.com

Accepted==&gt; David -- david@example.com

Accepted==&gt; Sean -- Sean@example.com
</code></pre>

<p><em><strong>Send email to below mentioned address:</em></strong></p>

<pre><code>byrne@example.com
neil@example.com
brendan@example.com
saunders@example.com
</code></pre>
