3v4l.org

run code in 300+ PHP versions simultaneously
<?php class integer { private $value; public function __construct(int $value = 0) : int { $this->value = $value; return $this->value; } public function __invoke(int ...$value) : int { if (count($value) === 1) $this->value = $value[0]; else throw new Exception('Multiple values given.'); return $this->value; } } $testi = new integer(1); $testi(2);
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.15
Fatal error: Default value for parameters with a class type hint can only be NULL in /in/QnZef on line 6
Process exited with code 255.

preferences:
181.29 ms | 1395 KiB | 22 Q