3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php abstract class FooBase { private $money; function __construct($money) { $this->money = $money; } function getMoney() { return $this->money; } } class Foo extends FooBase { private $money; function getMoney() { return '$' . parent::getMoney(); } function setMoney($money) { $this->money = $money; } } class Bar extends Foo { private $money; function getMoney() { return '$' . $this->money; } function setMoney($money) { $this->money = $money; } } $foo = new Foo(12345); var_dump($foo->getMoney()); $foo->setMoney(67890); var_dump($foo->getMoney()); $bar = new Bar(12345); var_dump($bar->getMoney()); $bar->setMoney(67890); var_dump($bar->getMoney());
Output for 5.3.7 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
string(6) "$12345" string(6) "$12345" string(1) "$" string(6) "$67890"