3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // Casting with integer or int are equivalent and work fine var_dump((integer) 2); var_dump((int) 3); // int as a return type hint works function returnFour() : int { // casting as integer satisfies the int return type hint return (integer) 4; } // int as a parmater type hit works function addOne(int $var2) : int { return $var2 + 1; } // integer as a return type hint does NOT work // Error function returnFive() : integer { return (integer) 5; } // integer as a parameter type hint does NOT work // Error function addOneInteger(integer $var1) : int { return $var1 + 1; } // the first two work $var1 = returnFour(); var_dump($var1); $var2 = addOne(8); var_dump($var2); // these ones fail $var3 = returnFive(7); var_dump($var3); $var4 = addOneInteger(4); var_dump($var4);
based on gv4n3

Here you find the average performance (time & memory) of each version. A greyed 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.100.0180.01116.15
7.1.90.0150.00816.13
7.1.80.0180.01016.07
7.1.70.0400.00715.04
7.1.60.2540.01033.19
7.1.50.0300.00333.00
7.1.40.0280.00732.61
7.1.30.0320.00532.63
7.1.20.0490.00732.65
7.1.10.3550.01314.55
7.1.00.0030.01414.71
7.0.240.3620.01315.63
7.0.230.0000.02215.85
7.0.220.0120.01215.88
7.0.210.3860.00714.58
7.0.200.0140.01014.71
7.0.190.0000.01514.76
7.0.180.0070.01114.45
7.0.170.0140.00514.46
7.0.160.0100.01014.27
7.0.150.3270.01414.38
7.0.140.3060.01014.71
7.0.130.0590.00714.63
7.0.120.0030.01514.56
7.0.110.1090.00714.50
7.0.100.0100.01014.38
7.0.90.0160.01314.52
7.0.80.0130.00814.60
7.0.70.3170.01714.38
7.0.60.0140.01114.10
7.0.50.0100.01714.59
7.0.40.3950.01314.51
7.0.30.2680.01714.54
7.0.20.2680.00714.63
7.0.10.2320.01014.51
7.0.00.2070.01314.49
hhvm-3.22.00.0810.20691.37
hhvm-3.21.30.0580.23391.01
hhvm-3.18.50.0760.20588.91
5.6.300.0130.06120.58
5.6.290.0200.06320.76
5.6.280.0150.06420.89
5.6.270.0170.06020.85
5.6.260.0230.05620.79
5.6.250.0230.06321.00
5.6.240.0100.07820.93
5.6.230.0220.06620.86
5.6.220.0060.09420.89
5.6.210.0160.07020.60
5.6.200.0200.07220.77
5.6.190.0270.07420.96
5.6.180.0100.06620.88
5.6.170.0160.07220.87
5.6.160.0100.08620.87
5.6.150.0320.06720.87
5.6.140.0100.06520.88
5.6.130.0190.05620.87
5.6.120.0100.06220.87
5.6.110.0130.06520.91
5.6.100.0240.05920.88
5.6.90.0140.05920.85
5.6.80.0100.05620.35
5.6.70.0130.06920.28
5.6.60.0230.07420.30
5.6.50.0140.05820.41
5.6.40.0070.06420.13
5.6.30.0100.06320.13
5.6.20.0130.08320.11
5.6.10.0170.07320.38
5.6.00.0230.06820.20