3v4l.org

run code in 300+ PHP versions simultaneously
<?php $files = [ 0 => 'scpt-01-2010.phtml', 1 => 'scpt-01-2011.phtml', 2 => 'scpt-02-2010.phtml', 3 => 'scpt-02-2011.phtml', 4 => 'scpt-03-2010.phtml', 5 => 'scpt-04-2010.phtml', 6 => 'scpt-05-2010.phtml', 7 => 'scpt-06-2010.phtml', 8 => 'scpt-07-2010.phtml', 9 => 'scpt-08-2010.phtml', 10 => 'scpt-09-2010.phtml', 11 => 'scpt-10-2010.phtml', 12 => 'scpt-11-2010.phtml', 13 => 'scpt-12-2010.phtml', ]; usort($files, function ($a, $b) { return array_reverse(explode('-', $b, 3)) <=> array_reverse(explode('-', $a, 3)); }); var_export($files);
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
array ( 0 => 'scpt-02-2011.phtml', 1 => 'scpt-01-2011.phtml', 2 => 'scpt-12-2010.phtml', 3 => 'scpt-11-2010.phtml', 4 => 'scpt-10-2010.phtml', 5 => 'scpt-09-2010.phtml', 6 => 'scpt-08-2010.phtml', 7 => 'scpt-07-2010.phtml', 8 => 'scpt-06-2010.phtml', 9 => 'scpt-05-2010.phtml', 10 => 'scpt-04-2010.phtml', 11 => 'scpt-03-2010.phtml', 12 => 'scpt-02-2010.phtml', 13 => 'scpt-01-2010.phtml', )
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
202.47 ms | 407 KiB | 5 Q