3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo{ public static $myvar = 99; public function __construct(){ $this->myvar = 35; } public function printMyVar(){ echo '->printMyVar(): '.$this->myvar; } public function setMyVar($mv){ $this->myvar = $mv; } } echo 'foo::$myvar: '.foo::$myvar."\n"; $foo = new foo(); echo $foo->printMyVar(); echo "\n"; echo 'foo::$myvar: '.foo::$myvar."\n"; echo "Conclusion: when using \$this-> to change the value, it adds another non-static version rather than changing the static version";
Output for git.master, git.master_jit, rfc.property-hooks
foo::$myvar: 99 Notice: Accessing static property foo::$myvar as non static in /in/cFaPO on line 7 Deprecated: Creation of dynamic property foo::$myvar is deprecated in /in/cFaPO on line 7 Notice: Accessing static property foo::$myvar as non static in /in/cFaPO on line 10 ->printMyVar(): 35 foo::$myvar: 99 Conclusion: when using $this-> to change the value, it adds another non-static version rather than changing the static version

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:
40.97 ms | 402 KiB | 8 Q