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)