3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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); return $start2; } $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"; }
Output for 7.1.0
Test1 is 26.1% faster than Test2
Output for 7.0.14
Test1 is 32.79% faster than Test2
Output for 7.0.7
Test1 is 22.49% faster than Test2
Output for 7.0.6
Test1 is 24% faster than Test2
Output for 7.0.5
Test1 is 24.73% faster than Test2
Output for 7.0.4
Test1 is 17.33% faster than Test2
Output for 7.0.3
Test1 is 21.94% faster than Test2
Output for 7.0.2
Test1 is 26.69% faster than Test2
Output for 7.0.1
Test1 is 25.17% faster than Test2
Output for 7.0.0
Test1 is 27.16% faster than Test2
Output for hhvm-3.12.0
Test2 is 5.25% faster than Test1
Output for hhvm-3.10.0
Test2 is 1.09% faster than Test1
Output for 5.6.28
Test1 is 12.51% faster than Test2
Output for 5.6.22
Test1 is 3.47% faster than Test2
Output for 5.6.21
Test1 is 13.09% faster than Test2
Output for 5.6.20
Test1 is 11.85% faster than Test2
Output for 5.6.19
Test1 is 13.63% faster than Test2
Output for 5.5.18, 5.6.18
Test1 is 11.16% faster than Test2
Output for 5.6.17
Test1 is 12.29% faster than Test2
Output for 5.6.16
Test1 is 11.68% faster than Test2
Output for 5.6.15
Test1 is 8.93% faster than Test2
Output for 5.6.14
Test1 is 9.22% faster than Test2
Output for 5.6.13
Test1 is 9.78% faster than Test2
Output for 5.6.12
Test1 is 12.89% faster than Test2
Output for 5.6.11
Test1 is 29.36% faster than Test2
Output for 5.6.10
Test1 is 10.27% faster than Test2
Output for 5.6.9
Test1 is 10.62% faster than Test2
Output for 5.6.8
Test1 is 12.45% faster than Test2
Output for 5.2.3, 5.6.7
Test1 is 8.75% faster than Test2
Output for 5.6.6
Test1 is 13.14% faster than Test2
Output for 5.6.5
Test1 is 8.34% faster than Test2
Output for 5.6.4
Test1 is 14.68% faster than Test2
Output for 5.6.3
Test1 is 12.58% faster than Test2
Output for 5.6.2
Test1 is 26.61% faster than Test2
Output for 4.3.3, 5.6.1
Test1 is 10.42% faster than Test2
Output for 5.6.0
Test1 is 10.72% faster than Test2
Output for 5.5.36
Test1 is 4.53% faster than Test2
Output for 5.5.35
Test1 is 7.3% faster than Test2
Output for 5.5.34
Test1 is 30.79% faster than Test2
Output for 5.5.33
Test1 is 9.84% faster than Test2
Output for 5.5.32
Test1 is 14% faster than Test2
Output for 5.1.3, 5.5.31
Test1 is 10.81% faster than Test2
Output for 5.5.30
Test1 is 11.73% faster than Test2
Output for 5.5.29
Test1 is 43.8% faster than Test2
Output for 5.5.28
Test1 is 9.4% faster than Test2
Output for 5.5.27
Test1 is 29.87% faster than Test2
Output for 5.5.26
Test1 is 10.65% faster than Test2
Output for 5.5.25
Test1 is 10.49% faster than Test2
Output for 5.5.24
Test1 is 12.25% faster than Test2
Output for 5.5.23
Test1 is 12.1% faster than Test2
Output for 5.5.22
Test1 is 10.94% faster than Test2
Output for 5.4.35, 5.5.21
Test1 is 9.95% faster than Test2
Output for 5.5.20
Test1 is 9.97% faster than Test2
Output for 5.5.19
Test1 is 11.7% faster than Test2
Output for 5.5.16
Test1 is 24.84% faster than Test2
Output for 5.5.15
Test2 is 2.82% faster than Test1
Output for 5.5.14
Test1 is 14.41% faster than Test2
Output for 5.5.13
Test1 is 14.04% faster than Test2
Output for 5.4.19, 5.5.12
Test1 is 11.45% faster than Test2
Output for 5.5.11
Test1 is 8.09% faster than Test2
Output for 5.5.10
Test1 is 9.9% faster than Test2
Output for 5.5.9
Test1 is 10.4% faster than Test2
Output for 5.5.8
Test1 is 13.26% faster than Test2
Output for 5.4.27, 5.5.7
Test1 is 9.27% faster than Test2
Output for 5.5.6
Test1 is 9.73% faster than Test2
Output for 5.4.31, 5.5.5
Test1 is 15.1% faster than Test2
Output for 5.5.4
Test1 is 9.89% faster than Test2
Output for 5.5.3
Test2 is 16.27% faster than Test1
Output for 5.5.2
Test1 is 9.7% faster than Test2
Output for 5.5.1
Test1 is 4.81% faster than Test2
Output for 5.5.0
Test1 is 5.26% faster than Test2
Output for 5.4.45
Test1 is 7.32% faster than Test2
Output for 5.4.44
Test1 is 2.1% faster than Test2
Output for 5.4.43
Test1 is 19.95% faster than Test2
Output for 5.4.42
Test1 is 5.92% faster than Test2
Output for 5.4.41
Test1 is 6.45% faster than Test2
Output for 5.4.40
Test1 is 7.85% faster than Test2
Output for 5.4.39
Test1 is 5.74% faster than Test2
Output for 5.4.38
Test1 is 7% faster than Test2
Output for 5.4.37
Test1 is 16.78% faster than Test2
Output for 5.4.36
Test1 is 3.17% faster than Test2
Output for 5.4.34
Test1 is 6.05% faster than Test2
Output for 5.4.32
Test1 is 1.09% faster than Test2
Output for 5.4.30
Test1 is 11.67% faster than Test2
Output for 5.4.29
Test1 is 3.75% faster than Test2
Output for 5.4.28
Test1 is 6.25% faster than Test2
Output for 5.4.26
Test1 is 8.08% faster than Test2
Output for 5.4.25
Test1 is 8.23% faster than Test2
Output for 5.4.24
Test1 is 5.91% faster than Test2
Output for 5.4.23
Test1 is 8.92% faster than Test2
Output for 5.4.22
Test1 is 6.3% faster than Test2
Output for 5.4.21
Test1 is 9.42% faster than Test2
Output for 4.4.3, 5.4.20
Test1 is 5.51% faster than Test2
Output for 5.4.18
Test1 is 10.28% faster than Test2
Output for 5.4.17
Test1 is 17.38% faster than Test2
Output for 5.4.16
Test1 is 6.73% faster than Test2
Output for 5.4.15
Test1 is 6.7% faster than Test2
Output for 5.4.14
Test1 is 9.31% faster than Test2
Output for 5.4.13
Test1 is 0.31999999999999% faster than Test2
Output for 5.4.12
Test1 is 7.2% faster than Test2
Output for 5.4.11
Test1 is 1.01% faster than Test2
Output for 5.4.10
Test1 is 6.51% faster than Test2
Output for 5.4.9
Test1 is 2.7% faster than Test2
Output for 5.4.8
Test1 is 4.15% faster than Test2
Output for 5.4.7
Test1 is 4.41% faster than Test2
Output for 5.4.6
Test1 is 5.77% faster than Test2
Output for 5.4.5
Test1 is 6.46% faster than Test2
Output for 5.4.4
Test1 is 6.74% faster than Test2
Output for 5.4.3
Test1 is 7.7% faster than Test2
Output for 5.4.2
Test1 is 11% faster than Test2
Output for 5.4.1
Test1 is 6.31% faster than Test2
Output for 5.4.0
Test1 is 12.63% faster than Test2
Output for 5.3.29
Test1 is 17.74% faster than Test2
Output for 5.3.28
Test1 is 2.68% faster than Test2
Output for 5.3.27
Test1 is 14.21% faster than Test2
Output for 5.3.26
Test1 is 3.91% faster than Test2
Output for 5.3.25
Test2 is 0.72% faster than Test1
Output for 5.3.24
Test1 is 3.01% faster than Test2
Output for 5.3.23
Test1 is 3.97% faster than Test2
Output for 5.3.22
Test1 is 4.3% faster than Test2
Output for 5.3.21
Test1 is 8.37% faster than Test2
Output for 5.3.20
Test1 is 4.79% faster than Test2
Output for 5.3.19
Test1 is 4.6% faster than Test2
Output for 5.3.18
Test1 is 5.53% faster than Test2
Output for 5.3.17
Test1 is 3.88% faster than Test2
Output for 5.3.16
Test1 is 5.49% faster than Test2
Output for 5.3.15
Test1 is 6.4% faster than Test2
Output for 5.3.14
Test1 is 4.77% faster than Test2
Output for 5.3.13
Test1 is 6.62% faster than Test2
Output for 5.3.12
Test1 is 6.09% faster than Test2
Output for 5.3.11
Test1 is 7.12% faster than Test2
Output for 5.3.10
Test1 is 12.11% faster than Test2
Output for 5.3.9
Test1 is 8.79% faster than Test2
Output for 5.3.8
Test1 is 8.87% faster than Test2
Output for 5.3.7
Test1 is 5.96% faster than Test2
Output for 5.3.6
Test1 is 4.29% faster than Test2
Output for 5.3.5
Test1 is 3.92% faster than Test2
Output for 5.3.4
Test1 is 8.56% faster than Test2
Output for 5.3.3
Test1 is 5.65% faster than Test2
Output for 5.3.2
Test1 is 3.7% faster than Test2
Output for 5.3.1
Test1 is 6.15% faster than Test2
Output for 5.3.0
Test1 is 6.67% faster than Test2
Output for 5.2.17
Test1 is 15.27% faster than Test2
Output for 5.2.16
Test1 is 12.53% faster than Test2
Output for 5.2.15
Test1 is 7.78% faster than Test2
Output for 5.2.14
Test1 is 17.82% faster than Test2
Output for 5.2.13
Test1 is 20.14% faster than Test2
Output for 5.2.12
Test1 is 5.95% faster than Test2
Output for 5.2.11
Test1 is 9.79% faster than Test2
Output for 5.2.10
Test1 is 20.86% faster than Test2
Output for 5.2.9
Test1 is 11.23% faster than Test2
Output for 5.2.8
Test1 is 7.55% faster than Test2
Output for 5.2.7
Test1 is 12.4% faster than Test2
Output for 5.2.6
Test1 is 10.05% faster than Test2
Output for 5.2.5
Test1 is 5.34% faster than Test2
Output for 5.2.4
Test1 is 10.93% faster than Test2
Output for 5.2.2
Test1 is 8.81% faster than Test2
Output for 5.2.1
Test1 is 8.9% faster than Test2
Output for 5.2.0
Test1 is 9.57% faster than Test2
Output for 5.1.6
Test1 is 3.76% faster than Test2
Output for 5.1.5
Test1 is 8.47% faster than Test2
Output for 5.1.4
Test1 is 7.77% faster than Test2
Output for 5.1.2
Test1 is 10.33% faster than Test2
Output for 5.1.1
Test1 is 14.05% faster than Test2
Output for 5.1.0
Test1 is 10.01% faster than Test2
Output for 5.0.5
Test1 is 13.37% faster than Test2
Output for 5.0.4
Test1 is 14.85% faster than Test2
Output for 5.0.3
Test1 is 16.57% faster than Test2
Output for 5.0.2
Test1 is 9.11% faster than Test2
Output for 5.0.1
Test1 is 7.27% faster than Test2
Output for 5.0.0
Test1 is 12.2% faster than Test2
Output for 4.4.9
Test1 is 7.15% faster than Test2
Output for 4.4.8
Test1 is 7.28% faster than Test2
Output for 4.4.7
Test1 is 16.8% faster than Test2
Output for 4.4.6
Test1 is 10.53% faster than Test2
Output for 4.4.5
Test1 is 8.59% faster than Test2
Output for 4.4.4
Test1 is 11.6% faster than Test2
Output for 4.4.2
Test1 is 13.48% faster than Test2
Output for 4.4.1
Test1 is 21.17% faster than Test2
Output for 4.4.0
Test1 is 9.54% faster than Test2
Output for 4.3.11
Test1 is 9.66% faster than Test2
Output for 4.3.10
Test1 is 11.82% faster than Test2
Output for 4.3.9
Test1 is 11.07% faster than Test2
Output for 4.3.8
Test1 is 12.19% faster than Test2
Output for 4.3.7
Test1 is 11.52% faster than Test2
Output for 4.3.6
Test1 is 11.34% faster than Test2
Output for 4.3.5
Test1 is 22.52% faster than Test2
Output for 4.3.4
Test1 is 28.87% faster than Test2
Output for 4.3.2
Test1 is 16.32% faster than Test2
Output for 4.3.1
Test1 is 11.5% faster than Test2
Output for 4.3.0
Test1 is 12.15% faster than Test2