Nested Foreach loop
<p>I am new to php. I have a foreach loop that checks for a ticket and outputs this ticket data into a google spreadsheet the other foreach loop stores the oldticket ids but i need to compare the new ticket id with the old ticket id array and if it exists delete it and add the new ticket data. Im having a problem comparing the old ticket id with the new 1 please advise on how this can be done. Thanks</p>

<pre><code>  foreach ($result-&gt;tickets as $ticket)
  {
    // For each for old ticket id's
    foreach ($result-&gt;tickets as $oldticket)
    {
           $oldid = $oldticket-&gt;id;
    }

    $row = array
    (
          "Ticket ID" =&gt; $ticket-&gt;id,
          "Ticket Title" =&gt; $ticket-&gt;title,
          "Created On" =&gt; $month_created_on,
          "Solved On" =&gt; $solved_on ,
          "Status" =&gt; $ticket-&gt;status,
          "Time Spent" =&gt; $ticket-&gt;time_spent,
          "Assigned To" =&gt; $ticket-&gt;assigned_to-&gt;full_name,
          "Mojo Number" =&gt; $ticket-&gt;assigned_to-&gt;mojo_number 
      );

    if ($ticket-&gt;id ==  $oldid){
                $ss-&gt;deleteRow($row);
    }
    $ss-&gt;addRow($row);

    return $row;
  }
</code></pre>

<p>Thanks in advance.</p>
