title: sort array by date,inside the same array
body: <p>I am working on a blogging site in codeigniter.In which the blog is to be listed in the last one first order.ie the last one will be on top.Here in my application variable $blogs contain all the blogs to be listed and the date_created.$blogs will display the blogs,but not in the required order.Now I want to sort the blog by the date_created value.</p>
  
  <p>the main model function that return the blogs is here</p>
  
  <pre><code>public function LoadAllBlogs(){
  
           $blogs = array();
  
           $this-&gt;db-&gt;select('id');
           $this-&gt;db-&gt;from('blog');
           $q=  $this-&gt;db-&gt;get();                                 
  
           foreach ($q-&gt;result() as $row) {
                 $blog = new Blog();
                 $blog-&gt;loadWithLatestPublishedEntry($row-&gt;id);
                 $blogs[] = $blog;
           }
  
       return $blogs; //contain all the blogs entry and the date in which blog is created
  }
  </code></pre>
  
  <p>can anyone help me.....</p>