3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function csort($a, $b) { $a = preg_split("/\s+/", $a); $b = preg_split("/\s+/", $b); return version_compare($a[1], $b[1]); } $r = array('abc 1.1', 'abc 1.0', 'abc 1.1.1'); usort($r, "csort"); print_r($r);
Output for 5.3.0 - 5.6.5, 5.6.7 - 7.2.6
Array ( [0] => abc 1.0 [1] => abc 1.1 [2] => abc 1.1.1 )
Output for 5.6.6

Process exited with code 137.