3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $testy; __construct($input) { $this->testy = $input; } public function doSomething() { return $this->testy * mt_rand(); } } $obj = new Test(1); echo $obj->doSomething();
Output for 5.4.0 - 5.4.21
Parse error: syntax error, unexpected '__construct' (T_STRING), expecting function (T_FUNCTION) in /in/hWq5d on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /in/hWq5d on line 6
Process exited with code 255.

preferences:
184.23 ms | 1395 KiB | 57 Q