3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Prototype { public function __call($method,$args) { $f = $this->$method; return $f(); } public function __construct($args) { foreach ($args as $k => $v) { $this->$k = $v; } } } $hoi = new Prototype( array( "monday" => function(){ return "monday"; }, "hello_monday" => function(){ echo "what a beautiful ".$this->monday()."!"; } ) ); $hoi->{"hello_monday"}();
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property Prototype::$monday is deprecated in /in/6U7Mj on line 13 Deprecated: Creation of dynamic property Prototype::$hello_monday is deprecated in /in/6U7Mj on line 13 Fatal error: Uncaught Error: Using $this when not in object context in /in/6U7Mj:24 Stack trace: #0 /in/6U7Mj(7): {closure}() #1 /in/6U7Mj(30): Prototype->__call('hello_monday', Array) #2 {main} thrown in /in/6U7Mj 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:
37.47 ms | 401 KiB | 8 Q