3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sortables = ['admin11class', 'adminclass12', '13adminclass']; usort($sortables, function($a, $b) { preg_match_all('!\d+!', $a, $matchesA); preg_match_all('!\d+!', $b, $matchesB); return $matchesA[0] > $matchesB[0]; }); var_dump($sortables);
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Deprecated: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in /in/DN315 on line 5 array(3) { [0]=> string(12) "admin11class" [1]=> string(12) "adminclass12" [2]=> string(12) "13adminclass" }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33
Deprecated: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in /in/DN315 on line 10 array(3) { [0]=> string(12) "admin11class" [1]=> string(12) "adminclass12" [2]=> string(12) "13adminclass" }
Output for 5.6.0 - 5.6.38, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
array(3) { [0]=> string(12) "admin11class" [1]=> string(12) "adminclass12" [2]=> string(12) "13adminclass" }

preferences:
142.88 ms | 410 KiB | 5 Q