3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $fruits[0]["expiryDate"] = ""; $fruits[1]["expiryDate"] = "20142643"; usort($fruits, "compareDates"); print_r($fruits); function compareDates($a, $b) { $t1 = $a['expiryDate']; $t2 = $b['expiryDate']; if ( $t1 == $t2) { return 0; } return ( $t1 > $t2) ? +1 : -1; }
based on ZHuco
Output for 4.3.0 - 7.1.0
Array ( [0] => Array ( [expiryDate] => ) [1] => Array ( [expiryDate] => 20142643 ) )