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/', function($a) { return strtoupper($a[0]); }, $str); $str = preg_replace_callback('/b/', function($a) { return strtoupper($a[0]); }, $str); $str = preg_replace_callback('/c/', function($a) { return strtoupper($a[0]); }, $str); $str = preg_replace_callback('/a/', function($a) { return strtolower($a[0]); }, $str); $str = preg_replace_callback('/b/', function($a) { return strtolower($a[0]); }, $str); $str = preg_replace_callback('/c/', function($a) { return strtolower($a[0]); }, $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.0190.00015.02
7.2.90.1650.00715.24
7.2.80.0090.01215.13
7.2.70.1520.00315.13
7.2.60.0140.00314.82
7.2.50.1770.00014.89
7.2.40.1550.01015.13
7.2.30.1670.00614.88
7.2.20.1570.00315.38
7.2.10.0120.01215.04
7.2.00.1710.01015.27
7.1.220.1950.01113.91
7.1.210.1600.00313.86
7.1.200.0030.01114.21
7.1.190.1620.00314.01
7.1.180.0320.00413.97
7.1.170.0090.01313.90
7.1.160.1880.00613.98
7.1.150.1260.00313.82
7.1.140.1250.00614.27
7.1.130.0170.00413.95
7.1.120.0360.00314.23
7.1.110.1320.01314.11
7.1.100.0980.00914.21
7.1.90.0500.00813.82
7.1.80.0750.00013.83
7.1.70.0070.00713.97
7.1.60.0680.00332.07
7.1.50.0460.00732.11
7.1.40.1800.00931.89
7.1.30.0510.00732.00
7.1.20.0760.00432.12
7.1.10.0100.00513.98
7.0.310.1160.00613.83
7.0.300.0100.00913.61
7.0.290.1490.01013.72
7.0.280.1230.01513.75
7.0.270.0080.00813.82
7.0.260.1200.00613.71
7.0.250.1150.00013.74
7.0.240.0500.00613.72
7.0.230.0190.00413.61
7.0.220.0050.01213.61
7.0.210.1310.00713.61
7.0.200.1740.00913.69
7.0.190.0140.00013.97
7.0.180.1270.00913.61
7.0.170.0770.01413.65
7.0.160.0090.00913.62
7.0.150.0100.00713.68
5.6.380.0100.00514.59
5.6.370.0030.01814.11
5.6.360.0050.01114.58
5.6.350.0040.01314.43
5.6.340.0200.00014.46
5.6.330.0130.00014.35
5.6.320.0140.00414.46
5.6.310.0080.00814.38
5.6.300.0120.01214.46

preferences:
30.64 ms | 401 KiB | 5 Q