3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Address { public $street; } class User { protected $address; public function getAddress() : Address { return $this->address; } public function setAddress(Address $address) { $this->address = $address; } } $user = new User(); $address = new Address(); $address->street = "Kozhikode"; $user->setAddress($address); $address = $user->getAddress(); var_dump($address->street);
based on Bqqs7
Output for 7.0.0 - 7.2.0
string(9) "Kozhikode"
Output for 5.3.18 - 5.6.28
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/JLk1T on line 10
Process exited with code 255.