title: How to convert the time from AM/PM to 24 hour format in PHP?
body: <p>For example, I have a time in this format:</p>
  
  <pre><code>eg. 
  
  09:15 AM
  04:25 PM
  11:25 AM
  </code></pre>
  
  <p>How do I convert it to :</p>
  
  <pre><code>09:15
  16:25
  23:25
  </code></pre>
  
  <p>Currently my code is :</p>
  
  <pre><code>$format_time = str_replace(" AM", "", $time, $count);
  if ($count === 0){
      $format_time = strstr($time, ' PM', true);
      $format_time = ......
  }
  </code></pre>
  
  <p>However, it seems there are some easier and more elegant way to do this?</p>
  
  <pre><code>$time = '23:45'; 
  echo date('g:i a', strtotime($time)); 
  </code></pre>
  
  <p>How do I fit the above sample in my case? Thanks.</p>