3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { //类常量 const constValue = "constValue"; //类属性 public $property = "properties"; //静态属性 static public $staticProperty = "staticProperty"; //普通函数 public function func() { } //静态函数 static public function staticFunc() { } } $xxoo = new A; //访问实例的属性 print $xxoo->property; //访问实例的函数 print $xxoo->func(); //也可以借助实例来访问静态成员 print $xxoo->staticFunc(); //如果不借助实例,那就直接用类名加双冒号 print A::staticFunc(); print A::constValue; print A::$staticProperty;
Output for git.master, git.master_jit, rfc.property-hooks
propertiesconstValuestaticProperty

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:
41.71 ms | 401 KiB | 8 Q