3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php final class Foo { private $bar; public function __construct($bar) { $this->bar = $bar; } public function readFromOtherObject(Foo $object) { return $object->bar; } } $a = new Foo('baz'); $b = new Foo('qux'); echo $a->readFromOtherObject($b);
Output for 5.6.0 - 7.3.0alpha1
qux