3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DICT { // список объектов private $objects = []; // создание объекта public function __set($name, $value){ if( !isset( $this->objects[$name] ) ){ $this->objects[$name] = $value; }else{ echo 'DICT name "'. $name .'" is already exist!'; } } // вызов объекта public function __call($name, $args){ if( isset( $this->objects[$name] ) ){ return call_user_func_array($this->objects[$name], $args); }else{ echo 'DICT name "'. $name .'" is not exist!'; } } } $a = new DICT; $a->b = function(){ echo 'b'; }; $a->c = new DICT; $a->b(); // работает $a->c->d = function(){ echo 'd'; }; $a->c->d();
Output for git.master, git.master_jit, rfc.property-hooks
b Deprecated: Creation of dynamic property DICT::$c is deprecated in /in/eAa12 on line 32 Fatal error: Uncaught Error: Attempt to assign property "d" on null in /in/eAa12:32 Stack trace: #0 {main} thrown in /in/eAa12 on line 32
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:
65.75 ms | 401 KiB | 8 Q