3v4l.org

run code in 300+ PHP versions simultaneously
<?php $loop = 100000; $s = 'a'; $t = 'b'; function t($p1, $p2) { return $p1.$p1; } $f1 = function() use ($s, $t) { return $s.$t; }; $f2 = function($s, $t) { return $s.$t; }; $tmp = $loop; $start = microtime(true); while($tmp--) { $r = t($s, $t); } echo 'Function: '. (microtime(true) - $start). "\n\n"; $tmp = $loop; $start = microtime(true); while($tmp--) { $r = $f1(); } echo 'Closure(use): '. (microtime(true) - $start). "\n\n"; $tmp = $loop; $start = microtime(true); while($tmp--) { $r = $f2($s, $t); } echo 'Closure(param): '. (microtime(true) - $start). "\n\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.40.1570.04018.11
7.2.30.1240.03418.15
7.2.20.2120.03718.18
7.2.10.1140.03718.24
7.2.00.1470.04018.01
7.1.160.1630.04317.01
7.1.150.1320.04417.00
7.1.140.1640.03816.77
7.1.130.1570.04116.82
7.1.120.1480.05916.95
7.1.110.1260.03916.22
7.1.100.2090.04916.09
7.1.90.1340.04315.82
7.1.80.1500.03916.36
7.1.70.1870.04015.26
7.1.60.1900.03932.96
7.1.50.2880.04133.03
7.1.40.3310.03932.65
7.1.30.2060.04032.45
7.1.20.1980.06632.88
7.1.10.2890.03814.85
7.1.00.1950.03614.79

preferences:
34.17 ms | 401 KiB | 5 Q