title: loop in time using laravel 8
body: <p>please i need your help to get time looping
  i have a start time and end time , and i want to list of array times with added 30 minutes i am trying to get code like below but array return empty</p>
  <pre class="lang-php prettyprint-override"><code>$available_times = [];
  $module = $garage-&gt;work_time;
  $from = date(&quot;H:i&quot;, strtotime($module-&gt;from));
  $to = date(&quot;H:i&quot;, strtotime($module-&gt;to));
  $time = strtotime($from);
  $new_time = date(&quot;H:i&quot;, strtotime('30 minutes', $time));
  if(!in_array(date(&quot;h:i a&quot; , strtotime($new_time)), $available_times))
  {
      array_push($available_times , date(&quot;h:i a&quot; , strtotime($new_time)));
  }
  while($new_time &lt; $to)
  {
      $time = strtotime($new_time);
      $new_time = date(&quot;H:i&quot;, strtotime('+30 minutes', $new_time));
      if($new_time . ':00' &gt;= $to)
      {
          break;
      }
  
      if(!in_array(date(&quot;h:i a&quot; , strtotime($new_time)), $available_times))
      {
          array_push($available_times , date(&quot;h:i a&quot; , strtotime($new_time)));
      }
  
  }
  return $available_times;
  </code></pre>
  <p>can any one help me i want a list like that</p>
  <pre><code>[
    &quot;9:30 am&quot;,
  &quot;10:00 am&quot;,
  &quot;10:30 am&quot;,
  &quot;11:00 am&quot;,
  &quot;11:30 am&quot;,
  ]
  </code></pre>
  <p>..etc,</p>