3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $a = 0; public function printCount() { print $this -> a; print PHP_EOL; // print a new line. } } class B { public $b = 0; public function doSomethingWith( $a ) { $a -> a++; } } $a = new A(); $b = new B(); $a -> printCount(); $b -> doSomethingWith( $a ); $a -> printCount();
Output for git.master, git.master_jit, rfc.property-hooks
0 Fatal error: Uncaught Error: Cannot access protected property A::$a in /in/JY4qT:20 Stack trace: #0 /in/JY4qT(27): B->doSomethingWith(Object(A)) #1 {main} thrown in /in/JY4qT on line 20
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
55.3 ms | 401 KiB | 8 Q