title: How to prevent duplicated values in a multidimentional array php
body: <p>I have this code:</p>
  <pre><code>&lt;?php
  
  $schedules = array();
  $schedules[0]['start_hour'] = &quot;08:00:00&quot;;
  $schedules[1]['start_hour'] = &quot;08:15:00&quot;;
  $schedules[2]['start_hour'] = &quot;08:30:00&quot;;
  $schedules = json_encode($schedules);
  $schedules = json_decode($schedules, FALSE);
  
  for ($i = strtotime(&quot;08:00:00&quot;); $i &lt;= strtotime(&quot;09:00:00&quot;); $i = $i+15*60):
      foreach($schedules as $sch):
          if($i == strtotime($sch-&gt;start_hour)):
              echo date(&quot;H:i&quot;, $i).&quot; SCHEDULED! &lt;br&gt;&quot;;
          else:
  echo date(&quot;H:i&quot;, $i).&quot; NOT SCHEDULED :( &lt;br /&gt;&quot;;
          endif;
      endforeach;
  endfor;
  
  ?&gt;
  </code></pre>
  <p>I have this first for, who goes from 08:00:00 to 09:00:00 each 15 minutes, and I have this second foreach, who check inside this array, which hours I have scheduled. i have this if who check which hours in the first for is in the schedules array, and print it, and if is not in the array, print as NOT SCHEDULED.
  The problem is, when I have 2 or more schedules in the array, the output duplicate the values. In this example, the output is:</p>
  <pre><code>08:00 SCHEDULED!
  08:00 NOT SCHEDULED :(
  08:00 NOT SCHEDULED :(
  08:15 NOT SCHEDULED :(
  08:15 SCHEDULED!
  08:15 NOT SCHEDULED :(
  08:30 NOT SCHEDULED :(
  08:30 NOT SCHEDULED :(
  08:30 SCHEDULED!
  08:45 NOT SCHEDULED :(
  08:45 NOT SCHEDULED :(
  08:45 NOT SCHEDULED :(
  09:00 NOT SCHEDULED :(
  09:00 NOT SCHEDULED :(
  09:00 NOT SCHEDULED :(
  </code></pre>
  <p>and I want something like:</p>
  <pre><code>08:00 SCHEDULED!
  08:15 SCHEDULED!
  08:30 SCHEDULED!
  08:45 NOT SCHEDULED :(
  09:00 NOT SCHEDULED :(
  </code></pre>
  <p>What can I do?</p>