3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace foo{ echo "1-Inside namespace foo \n"; use My\Full\Classname as Another; use ArrayObject; // importing a global class echo "2-After using ArrayObject line: ".__LINE__."\n"; class Another { public function cname() { echo "line".__LINE__."Method".__METHOD__."\n"; } static function method(){echo "line".__LINE__."Method: ".__METHOD__."\n";} } //This line below is Not working. $obj1 = new namespace\Another; // instantiates object of foo\Another echo "3-After namespace\Another object line: ".__LINE__."\n"; //This line below is Not working. echo "4-".$obj1->method()."\n"; //This line below is Not working. $obj2 = new Another; // instantiates object of class My\Full\Classname echo "5-After Another object line: ".__LINE__."\n"; //This line below is Not working. echo "6-".$obj2->method()."\n"; echo "7-After Another object line: ".__LINE__."\n"; //This line below is Not working. $a = new ArrayObject(array(1)); // instantiates object of ArrayObject echo "8-After ArrayObject line: ".__LINE__."\n"; } namespace My\Full{ class Classname{ public function cname() { echo "line".__LINE__."Method".__METHOD__."\n"; } static function method(){echo "line".__LINE__."Method: ".__METHOD__."\n";} } }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Cannot declare class foo\Another because the name is already in use in /in/HELPM on line 7
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:
52.76 ms | 401 KiB | 8 Q