3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function _static($m,$n, $v = null) { static $vars = array(); switch($m) { case 'g': return $vars[$n]; break; case 's': $vars[$n]=$v; break; case 'i': isset($vars[$n]); break; case 'u': unset($vars[$n]); break; } } function _static_g($n) { $self = __CLASS__; return $self::_static('g',$n); } function _static_s($n,$v) { $self = __CLASS__; return $self::_static('s',$n,$v); } function _static_i($n) { $self = __CLASS__; return $self::_static('i',$n); } function _static_u($n) { $self = __CLASS__; return $self::_static('u',$n); } } A::_static_s('q', 5); echo A::_static_g('q');
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Non-static method A::_static_s() cannot be called statically in /in/274Wb:46 Stack trace: #0 {main} thrown in /in/274Wb on line 46
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:
44.24 ms | 401 KiB | 8 Q