3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bodyMarkdown = <<<'TEXT' "There&#39;s no difference between them in a final class, so use whichever you want. \r\n\r\nBoth calls will return `A`.\r\n```\r\n&lt;?php\r\n\r\nclass Dad {\r\n static function getStatic() {\r\n return new static;\r\n }\r\n \r\n static function getSelf() {\r\n return new self;\r\n }\r\n}\r\n\r\ntrait Useless {\r\n static function getStatic() {\r\n return new static;\r\n }\r\n}\r\n\r\nfinal class A extends Dad {\r\n use Useless;\r\n \r\n static function getSelf() {\r\n return new self;\r\n }\r\n}\r\n\r\nvar_dump(A::getStatic()::class);\r\nvar_dump(A::getSelf()::class);\r\n```\r\n\r\n\r\n\r\n[Example][1]\r\n\r\nhope this helps\r\ndharman\r\n\r\n [1]: https://3v4l.org/CsmAr#v8.0.8" TEXT; $bodyCleansed = json_decode($bodyMarkdown); $username = preg_quote('Dharman', '/'); $re = '/((?<=\.)|\s*^)\s* #space before (I\h)?hope\h(it|this|that) (\hwill\b|\hcan\b)? \hhelps? (\h(you|someone(?:\h*else)?)\b)? (:-?\)|🙂️|[!.;,\s])*? #punctuation and emoji (\s*(cheers|good ?luck)([!,.]*))? # sometimes appears on the same line or next (?:[-~\s]*'.$username.')? $/mix'; $bodyCleansed = preg_replace($re, '', $bodyCleansed, -1, $count); echo($bodyCleansed);
Output for git.master, git.master_jit, rfc.property-hooks
There&#39;s no difference between them in a final class, so use whichever you want. Both calls will return `A`. ``` &lt;?php class Dad { static function getStatic() { return new static; } static function getSelf() { return new self; } } trait Useless { static function getStatic() { return new static; } } final class A extends Dad { use Useless; static function getSelf() { return new self; } } var_dump(A::getStatic()::class); var_dump(A::getSelf()::class); ``` [Example][1] dharman [1]: https://3v4l.org/CsmAr#v8.0.8

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