3v4l.org

run code in 500+ PHP versions simultaneously
<?php function filterwords(string $text, array $bannedWords) { return preg_replace_callback( '/\b(?:' . implode('|', $bannedWords) . ')\b/iu', fn($m) => str_repeat('*', mb_strlen($m[0])), $text ); } echo filterwords("I am a dummy, but I'm not dumb", ['dummy']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lm0EU
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                                   'filterwords'
          1        SEND_VAL                                                     'I+am+a+dummy%2C+but+I%27m+not+dumb'
          2        SEND_VAL                                                     <array>
          3        DO_FCALL                                          0  $0      
          4        ECHO                                                         $0
          5      > RETURN                                                       1

Function filterwords:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lm0EU
function name:  filterwords
number of ops:  13
compiled vars:  !0 = $text, !1 = $bannedWords
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    5     2        INIT_FCALL                                                   'preg_replace_callback'
    6     3        FRAMELESS_ICALL_2                implode             ~2      '%7C', !1
          4        CONCAT                                               ~3      '%2F%5Cb%28%3F%3A', ~2
          5        CONCAT                                               ~4      ~3, '%29%5Cb%2Fiu'
          6        SEND_VAL                                                     ~4
    7     7        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
          8        SEND_VAL                                                     ~5
    8     9        SEND_VAR                                                     !0
    5    10        DO_ICALL                                             $6      
    8    11      > RETURN                                                       $6
   10    12*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lm0EU
function name:  {closure:filterwords():7}
number of ops:  11
compiled vars:  !0 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        INIT_FCALL                                                   'str_repeat'
          2        SEND_VAL                                                     '%2A'
          3        INIT_FCALL                                                   'mb_strlen'
          4        FETCH_DIM_R                                          ~1      !0, 0
          5        SEND_VAL                                                     ~1
          6        DO_ICALL                                             $2      
          7        SEND_VAR                                                     $2
          8        DO_ICALL                                             $3      
          9      > RETURN                                                       $3
         10*     > RETURN                                                       null

End of Dynamic Function 0

End of function filterwords

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.96 ms | 1592 KiB | 17 Q