3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $_property = "Foo"; public function get() { return $this->_property; } public function modifyProperty(Foo $other, $value) { $other->_property = $value; } } $foo = new Foo(); $bar = new Foo(); printf("bar _property: %s\n",$bar->get()); // prints: bar _property: Foo $foo->modifyProperty($bar, "Bar"); printf("bar _property: %s\n",$bar->get()); /
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.28
Parse error: syntax error, unexpected '/' in /in/MZVUK on line 22
Process exited with code 255.

preferences:
176.44 ms | 1399 KiB | 65 Q