3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test1() { $str = 'derp'; if ($str != 'files' && $str != 'something' && $str != 'Derrr') { return; } return; } function test2() { $str = 'derp'; switch ($str) { case 'files': case 'something': case 'Derrr': break; default: return; } return; } function runTest1() { $start1 = microtime(1); for ($i = 1; $i < 10000; $i++) { test1(); } $start1 -= microtime(1); return $start1; } function runTest2() $start2 = microtime(1); for ($i = 1; $i < 10000; $i++) { test2(); } $start2 -= microtime(1); } $start1 = runTest1(); $start2 = runTest2(); if ($start1 < $start2) { $perc = 100-round(($start2 / $start1) * 100,2); echo "Test1 is $perc"."% faster than Test2"; } if ($start2 < $start1) { $perc = 100-round(($start1 / $start2) * 100,2); echo "Test2 is $perc"."% faster than Test1"; }

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)
5.4.100.0180.05812.01
5.4.90.0240.05212.01
5.4.80.0170.04212.01
5.4.70.0200.03812.01
5.4.60.0240.06412.00
5.4.50.0180.04012.01
5.4.40.0170.04212.00
5.4.30.0210.06911.99
5.4.20.0180.04011.99
5.4.10.0150.04411.99
5.4.00.0140.04311.48
5.3.200.0200.04412.68
5.3.190.0180.04612.68
5.3.180.0250.05212.67
5.3.170.0160.04712.67
5.3.160.0270.06412.67
5.3.150.0180.04412.67
5.3.140.0150.04712.66
5.3.130.0260.06612.66
5.3.120.0190.04412.66
5.3.110.0190.04412.65
5.3.100.0300.06212.12
5.3.90.0260.06312.11
5.3.80.0160.04512.10
5.3.70.0150.04712.09
5.3.60.0310.06112.08
5.3.50.0210.04012.03
5.3.40.0190.04412.02
5.3.30.0260.05111.99
5.3.20.0290.06211.77
5.3.10.0180.04011.74
5.3.00.0200.04211.72

preferences:
139.11 ms | 1394 KiB | 7 Q