3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data = array( array( "title" => "Another title", "date" => "Fri, 17 Jun 2011 08:55:57 +0200" ), array( "title" => "My title", "date" => "Mon, 16 Jun 2010 06:55:57 +0200" ) ); function sortFunction( $a, $b ) { return strtotime($a["date"]) - strtotime($b["date"]); } usort($data, "sortFunction"); var_dump($data);
based on s2IJM
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(2) { [0]=> array(2) { ["title"]=> string(8) "My title" ["date"]=> string(31) "Mon, 16 Jun 2010 06:55:57 +0200" } [1]=> array(2) { ["title"]=> string(13) "Another title" ["date"]=> string(31) "Fri, 17 Jun 2011 08:55:57 +0200" } }