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 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
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
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 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

preferences:
147.76 ms | 403 KiB | 156 Q