3v4l.org

run code in 300+ PHP versions simultaneously
<?php $patternsArray = array(); $matchesArray = array(); $text = " Cassie, slipped on some glass and cut her ass!<br> 'Goshdamnit! Who left this damn mess out?' she cried.<br> 'Well, SHOOT, you should be more careful!' Mary laughed.<br> 'Hello! Why don't you clean up after yourself!' Cassie screamed.<br> 'Go to HELL!' Mary yelled back.<br> Then suddenly, blood started shooting everywhere.XXX "; $patternsArray[] = '/\basss?\b/i'; $patternsArray[] = '/damn/i'; $patternsArray[] = '/\bshoots?\b/i'; $patternsArray[] = '/\bhells?\b/i'; $patternsArray[] = '/XXX/i'; $cleanText = preg_replace_callback($patternsArray, function($matches) use (&$matchesArray) { list($word) = $matches; $matchesArray[] = $word; return str_repeat("*", strlen($word)); }, $text); var_dump($cleanText); var_dump($matchesArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ouWgX
function name:  (null)
number of ops:  28
compiled vars:  !0 = $patternsArray, !1 = $matchesArray, !2 = $text, !3 = $cleanText
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, '%0A%09Cassie%2C+slipped+on+some+glass+and+cut+her+ass%21%3Cbr%3E%0A%09%27Goshdamnit%21+Who+left+this+damn+mess+out%3F%27+she+cried.%3Cbr%3E%0A%09%27Well%2C+SHOOT%2C+you+should+be+more+careful%21%27+Mary+laughed.%3Cbr%3E%0A%09%27Hello%21+Why+don%27t+you+clean+up+after+yourself%21%27+Cassie+screamed.%3Cbr%3E%0A%09%27Go+to+HELL%21%27+Mary+yelled+back.%3Cbr%3E%0A%09Then+suddenly%2C+blood+started+shooting+everywhere.XXX%0A'
   15     3        ASSIGN_DIM                                               !0
          4        OP_DATA                                                  '%2F%5Cbasss%3F%5Cb%2Fi'
   16     5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  '%2Fdamn%2Fi'
   17     7        ASSIGN_DIM                                               !0
          8        OP_DATA                                                  '%2F%5Cbshoots%3F%5Cb%2Fi'
   18     9        ASSIGN_DIM                                               !0
         10        OP_DATA                                                  '%2F%5Cbhells%3F%5Cb%2Fi'
   19    11        ASSIGN_DIM                                               !0
         12        OP_DATA                                                  '%2FXXX%2Fi'
   21    13        INIT_FCALL                                               'preg_replace_callback'
         14        SEND_VAR                                                 !0
         15        DECLARE_LAMBDA_FUNCTION                          ~12     [0]
         16        BIND_LEXICAL                                             ~12, !1
   25    17        SEND_VAL                                                 ~12
         18        SEND_VAR                                                 !2
   21    19        DO_ICALL                                         $13     
         20        ASSIGN                                                   !3, $13
   27    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                                 
   28    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                                 
         27      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ouWgX
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $matches, !1 = $matchesArray, !2 = $word
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   22     2        QM_ASSIGN                                        ~3      !0
          3        FETCH_LIST_R                                     $4      ~3, 0
          4        ASSIGN                                                   !2, $4
          5        FREE                                                     ~3
   23     6        ASSIGN_DIM                                               !1
          7        OP_DATA                                                  !2
   24     8        INIT_FCALL                                               'str_repeat'
          9        SEND_VAL                                                 '%2A'
         10        STRLEN                                           ~7      !2
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                         $8      
         13      > RETURN                                                   $8
   25    14*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.83 ms | 1017 KiB | 16 Q