3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Dog { private $noise; public function __construct(string $noise) { $this->noise = $noise; } public function bark() { print $this->noise; } } $dog = new Dog("woooof!"); $dog->bark();
based on A8qNn
Output for 7.0.0 - 7.2.0
woooof!
Output for 5.3.17 - 5.6.28
Catchable fatal error: Argument 1 passed to Dog::__construct() must be an instance of string, string given, called in /in/DLui0 on line 16 and defined in /in/DLui0 on line 6
Process exited with code 255.