3v4l.org

run code in 500+ PHP versions simultaneously
<?php class myclass { private $anotherProp='Another property value'; public function __set($prop,$val){ if(! property_exists($this,$prop) ){ $this->$prop=$val; echo $this->$prop; }else{ echo 'property already exists' . "\n"; } } } $obj=new myclass(); $obj->newProp='i am a new property' . "\n"; $obj->anotherProp='i am another property' . "\n"; var_dump($obj);
Output for rfc.property-hooks, git.master, git.master_jit
Deprecated: Creation of dynamic property myclass::$newProp is deprecated in /in/uKQiH on line 9 i am a new property property already exists object(myclass)#1 (2) { ["anotherProp":"myclass":private]=> string(22) "Another property value" ["newProp"]=> string(20) "i am a new property " }

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:
45.55 ms | 2264 KiB | 4 Q