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); $b = new Money(1); echo $a->amount === 1; echo $a->amount == 1;
based on SIT7t
Output for 7.0.0 - 7.3.0rc4
Fatal error: Uncaught Error: Cannot access private property Money::$amount in /in/ISWBa:22 Stack trace: #0 {main} thrown in /in/ISWBa on line 22
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Fatal error: Cannot access private property Money::$amount in /in/ISWBa on line 22
Process exited with code 255.