3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { public $public = 'Pub'; protected $protected = 'Protec'; private $private = 'Pri'; function printHello() { echo $this->public; echo $this->protected; echo $this->private; } } class MyClass2 extends MyClass { // We can redeclare the public and protected method, but not private protected $protected = 'Protected2'; function printHello() { echo $this->public; echo $this->protected; echo $this->private; } } $obj2 = new MyClass2(); echo $obj2->public; // Works //echo $obj2->protected; // Fatal Error //echo $obj2->private; // Undefined //$obj2->printHello(); // Shows Public, Protected2, Undefined ?>
Output for git.master, git.master_jit, rfc.property-hooks
Pub

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:
35.81 ms | 401 KiB | 8 Q