title: PHP Sort Array by date value
body: <p>I have the following array format in my php code:</p>
  
  <pre><code>foreach ($events as $info) {
      $events_array[] = array(
          'title' =&gt; $info-&gt;Name,
          'date'  =&gt; $info-&gt;Date
      );
  }
  function cb($a, $b) {
      return strtotime($a['date']) - strtotime($b['date']);
  }
  usort($events_array, 'cb');
  </code></pre>
  
  <p>Edit: The date values are in the format: YYYY-MM-DD</p>
  
  <p>Actually, when I do print_r, I get</p>
  
  <pre><code>[title] =&gt; SimpleXMLElement Object ( ) [date] =&gt; SimpleXMLElement Object ( )
  </code></pre>