3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { private $private_bar = 'private'; protected $protected_bar = 'protected'; public $public_bar = 'public'; public static $static_bar = 'static'; private function private_echo() { echo $this->private_bar; } protected function protected_echo() { echo $this->protected_bar; } public function public_echo() { echo $this->public_bar; } public static function static_echo() { echo $this->static_bar; } } $myfoo = new foo(); // $myfoo->static_echo(); $myfoo->public_echo(); // $myfoo->protected_echo(); //$myfoo->private_bar = 'new private bar'; //$myfoo->private_echo(); $myfoo::static_echo(); ?>
Output for git.master, git.master_jit, rfc.property-hooks
public Fatal error: Uncaught Error: Using $this when not in object context in /in/LFYOT:24 Stack trace: #0 /in/LFYOT(36): foo::static_echo() #1 {main} thrown in /in/LFYOT on line 24
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:
41.79 ms | 401 KiB | 8 Q