3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Address { public $street; } class User { protected $address; public function __construct(Address $address){ $this->address = $address; } public function getAddress() : Address { return $this->address; } } $user = new User(new Addres()); $address = $user->getAddress(); var_dump($address->street);
based on Bqqs7
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Class 'Addres' not found in /in/81pGY:20 Stack trace: #0 {main} thrown in /in/81pGY on line 20
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/81pGY on line 14
Process exited with code 255.