3v4l.org

run code in 300+ PHP versions simultaneously
<?php $count = 100; $start = microtime(true); for ($i = 0; $i < $count; $i++) { $str = "abc"; $str = preg_replace_callback('/a/', 'strtoupper', $str); $str = preg_replace_callback('/b/', 'strtoupper', $str); $str = preg_replace_callback('/c/', 'strtoupper', $str); $str = preg_replace_callback('/a/', 'strtolower', $str); $str = preg_replace_callback('/b/', 'strtolower', $str); $str = preg_replace_callback('/c/', 'strtolower', $str); } echo "Completed in " . (microtime(true) - $start) . " Seconds\n"; $start = microtime(true); for ($i = 0; $i < $count; $i++) { $str = "abc"; $str = preg_replace(array( '/a/e', '/b/e', '/c/e', '/a/e', '/b/e', '/c/e', ), array( 'strtoupper(\'$1\')', 'strtoupper(\'$1\')', 'strtoupper(\'$1\')', 'strtolower(\'$1\')', 'strtolower(\'$1\')', 'strtolower(\'$1\')', ), $str ); } echo "Completed in " . (microtime(true) - $start) . " Seconds\n";

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.2.100.1200.00614.96
7.2.90.1410.00614.45
7.2.80.1040.00814.93
7.2.70.1510.00615.34
7.2.60.0320.00315.21
7.2.50.0950.00615.27
7.2.40.0980.00914.92
7.1.220.1190.01513.73
7.1.210.1400.01614.15
7.1.200.1540.00013.78
7.1.190.2050.01013.96
7.1.180.0900.01013.68
7.1.170.0910.00313.98
7.1.160.0660.01014.03
7.0.310.1120.01013.50
7.0.300.0250.01113.57
7.0.290.0890.01013.83
5.6.380.0080.01514.45
5.6.370.0110.01114.43
5.6.360.0140.01114.56

preferences:
33.5 ms | 401 KiB | 5 Q