3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Money { private $amount; public function __construct($amount) { $this->amount = $amount; } public function equals(Money $otherMoney) { return $this->amount === $otherMoney->amount; } } $a = new Money(1); echo $a->amount === 1;
based on HIMTN
Output for 7.0.0 - 7.3.0rc4
Fatal error: Uncaught Error: Cannot access private property Money::$amount in /in/qi93g:21 Stack trace: #0 {main} thrown in /in/qi93g on line 21
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Fatal error: Cannot access private property Money::$amount in /in/qi93g on line 21
Process exited with code 255.