3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Liam { public function __construct() { $this->printString(); $this->printArray(); } public function printString(string $prefix) : string { print $this->_generateString(); } public function printArray(array $array) : array { print array(); } private function _generateString() : string { return random(1,255); } } print_r(new Liam());
based on XLpSp
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Liam::printString(), 0 passed in /in/aa44t on line 5 and exactly 1 expected in /in/aa44t:9 Stack trace: #0 /in/aa44t(5): Liam->printString() #1 /in/aa44t(23): Liam->__construct() #2 {main} thrown in /in/aa44t on line 9
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Fatal error: Uncaught TypeError: Argument 1 passed to Liam::printString() must be of the type string, none given, called in /in/aa44t on line 5 and defined in /in/aa44t:9 Stack trace: #0 /in/aa44t(5): Liam->printString() #1 /in/aa44t(23): Liam->__construct() #2 {main} thrown in /in/aa44t on line 9
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/aa44t on line 9
Process exited with code 255.