3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class ThingDoer { protected $things; public function __construct(string $string = NULL, int $int = 0, Throwable $throwable = NULL) { $this->things[] = $string; $this->things[] = $int; $this->things[] = $throwable; } public function do() { print_r($this->things); } } $thing = new ThingDoer(); $thing->do();
based on KmVhr
Output for hhvm-3.15.4, 7.0.0 - 7.3.0rc3
Array ( [0] => [1] => 0 [2] => )
Output for 5.6.0 - 5.6.30
Fatal error: Default value for parameters with a class type hint can only be NULL in /in/bsik0 on line 5
Process exited with code 255.