3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $var; function connectToDB($string) { return false } switch (false) { // check if we have DB credentials. case isset($DBcredentials): $DBcredentials = 'myawesomepassword';; echo "Setting var" . PHP_EOL; // connect to DB. case connectToDB($DBcredentials): // delberiate fall through, case $var is *not* caught, but we end here anyways. $var = 1; echo "Truthing Var" . PHP_EOL; case is_string($var): // delebirate fall through, case is_string($var) is *not* caught, but we end here anyways. $var = (string) $var; echo "Stringing var" . PHP_EOL; break; /* case customGuardFunction() */ default: echo "All checks passed!"; } var_dump($var);
based on rAMRi

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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.1.70.0020.01616.71
7.1.60.0230.01734.97
7.1.50.0190.01334.41
7.1.40.0270.01434.33
7.1.30.0250.01634.38
7.1.20.0250.01634.39
7.1.10.0060.01316.39
7.1.00.0240.01316.32
7.0.200.0090.00616.64
7.0.190.0060.01316.39
7.0.180.0100.01116.12
7.0.170.0050.01416.00
7.0.160.0040.01716.21
7.0.150.0060.01416.13
7.0.140.0050.01516.05
7.0.130.0080.01316.34
7.0.120.0100.01116.25
7.0.110.0070.01316.17
7.0.100.0060.01315.87
7.0.90.0090.00916.23
7.0.80.0100.01116.23
7.0.70.0190.00016.23
7.0.60.0130.01115.70
7.0.50.0110.01216.36
7.0.40.0060.01416.28
7.0.30.0020.01616.28
7.0.20.0140.00516.29
7.0.10.0030.01716.02
7.0.00.0030.01516.14
hhvm-3.15.40.0780.21687.42
5.6.300.0030.09120.75
5.6.290.0140.08120.81
5.6.280.0230.07720.98
5.6.270.0150.07620.87
5.6.260.0220.08320.80
5.6.250.0160.07120.75
5.6.240.0260.07320.96
5.6.230.0020.09520.71
5.6.220.0190.08720.84
5.6.210.0260.05020.96
5.6.200.0230.07520.83
5.6.190.0090.08920.72
5.6.180.0140.07420.69
5.6.170.0150.07020.93
5.6.160.0220.06620.68
5.6.150.0070.08220.92
5.6.140.0200.07020.71
5.6.130.0280.06320.71
5.6.120.0150.07120.65
5.6.110.0120.08320.72
5.6.100.0090.09320.86
5.6.90.0200.07020.73
5.6.80.0200.06120.13
5.6.70.0170.06520.19
5.6.60.0160.08020.25
5.6.50.0200.07020.07
5.6.40.0250.06820.29
5.6.30.0230.07120.08
5.6.20.0250.07120.17
5.6.10.0130.07720.27
5.6.00.0120.07520.17