3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $myPrivateProperty = 'I am private'; public function doSomethingWithADifferentObject($otherObject) { var_dump($otherObject->myPrivateProperty); } } class B extends A {} $a1 = new A; $a2 = new B; $a1->doSomethingWithADifferentObject($a2);

preferences:
51.75 ms | 402 KiB | 5 Q