3v4l.org

run code in 300+ 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:  16
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        INIT_FCALL                                               'implode'
          4        SEND_VAL                                                 '%7C'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $2      
          7        CONCAT                                           ~3      '%2F%5Cb%28%3F%3A', $2
          8        CONCAT                                           ~4      ~3, '%29%5Cb%2Fiu'
          9        SEND_VAL                                                 ~4
    7    10        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
         11        SEND_VAL                                                 ~5
    8    12        SEND_VAR                                                 !0
    5    13        DO_ICALL                                         $6      
    8    14      > RETURN                                                   $6
   10    15*     > 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}
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.0.0


preferences:
150.69 ms | 1020 KiB | 18 Q