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);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t3QUE
function name:  (null)
number of ops:  23
compiled vars:  !0 = $bodyMarkdown, !1 = $bodyCleansed, !2 = $username, !3 = $re, !4 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%22There%26%2339%3Bs+no+difference+between+them+in+a+final+class%2C+so+use+whichever+you+want.+%5Cr%5Cn%5Cr%5CnBoth+calls+will+return+%60A%60.%5Cr%5Cn%60%60%60%5Cr%5Cn%26lt%3B%3Fphp%5Cr%5Cn%5Cr%5Cnclass+Dad+%7B%5Cr%5Cn++++static+function+getStatic%28%29+%7B%5Cr%5Cn++++++++return+new+static%3B%5Cr%5Cn++++%7D%5Cr%5Cn++++%5Cr%5Cn++++static+function+getSelf%28%29+%7B%5Cr%5Cn++++++++return+new+self%3B%5Cr%5Cn++++%7D%5Cr%5Cn%7D%5Cr%5Cn%5Cr%5Cntrait+Useless+%7B%5Cr%5Cn++++static+function+getStatic%28%29+%7B%5Cr%5Cn++++++++return+new+static%3B%5Cr%5Cn++++%7D%5Cr%5Cn%7D%5Cr%5Cn%5Cr%5Cnfinal+class+A+extends+Dad+%7B%5Cr%5Cn++++use+Useless%3B%5Cr%5Cn++++%5Cr%5Cn++++static+function+getSelf%28%29+%7B%5Cr%5Cn++++++++return+new+self%3B%5Cr%5Cn++++%7D%5Cr%5Cn%7D%5Cr%5Cn%5Cr%5Cnvar_dump%28A%3A%3AgetStatic%28%29%3A%3Aclass%29%3B%5Cr%5Cnvar_dump%28A%3A%3AgetSelf%28%29%3A%3Aclass%29%3B%5Cr%5Cn%60%60%60%5Cr%5Cn%5Cr%5Cn%5Cr%5Cn%5Cr%5Cn%5BExample%5D%5B1%5D%5Cr%5Cn%5Cr%5Cnhope+this+helps%5Cr%5Cndharman%5Cr%5Cn%5Cr%5Cn++%5B1%5D%3A+https%3A%2F%2F3v4l.org%2FCsmAr%23v8.0.8%22'
    7     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
    9     5        INIT_FCALL                                               'preg_quote'
          6        SEND_VAL                                                 'Dharman'
          7        SEND_VAL                                                 '%2F'
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !2, $8
   17    10        CONCAT                                           ~10     '%2F%28%28%3F%3C%3D%5C.%29%7C%5Cs%2A%5E%29%5Cs%2A%09%09%09%23space+before%0A++++%28I%5Ch%29%3Fhope%5Ch%28it%7Cthis%7Cthat%29%0A++++%28%5Chwill%5Cb%7C%5Chcan%5Cb%29%3F%0A++++%5Chhelps%3F%0A++++%28%5Ch%28you%7Csomeone%28%3F%3A%5Ch%2Aelse%29%3F%29%5Cb%29%3F%0A++++%28%3A-%3F%5C%29%7C%F0%9F%99%82%EF%B8%8F%7C%5B%21.%3B%2C%5Cs%5D%29%2A%3F%09%09%09%09%23punctuation+and+emoji%0A++++%28%5Cs%2A%28cheers%7Cgood+%3Fluck%29%28%5B%21%2C.%5D%2A%29%29%3F%09%23+sometimes+appears+on+the+same+line+or+next%0A++++%28%3F%3A%5B-%7E%5Cs%5D%2A', !2
         11        CONCAT                                           ~11     ~10, '%29%3F%0A++++%24%2Fmix'
   10    12        ASSIGN                                                   !3, ~11
   19    13        INIT_FCALL                                               'preg_replace'
         14        SEND_VAR                                                 !3
         15        SEND_VAL                                                 ''
         16        SEND_VAR                                                 !1
         17        SEND_VAL                                                 -1
         18        SEND_REF                                                 !4
         19        DO_ICALL                                         $13     
         20        ASSIGN                                                   !1, $13
   21    21        ECHO                                                     !1
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
126.41 ms | 1401 KiB | 19 Q