3v4l.org

run code in 300+ PHP versions simultaneously
<?php $originalString = 'Her (III.1) was the age of 2 years and 11 months. (shoulder a 4/5)'; $findStringArray = array("age", "(III.1)", "2", "months", "4"); $words = explode(" ",$originalString); for($x = 0; $x<count($words); $x++) { foreach($findStringArray as $key => $value) { $originalString = preg_replace('/\b('.preg_quote($value).')\b/i', "__", $words[$x]); } } $newstring = implode(" ", $words); echo $newstring;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 9
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 25
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 25
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 9
Branch analysis from position: 30
Branch analysis from position: 9
Branch analysis from position: 25
filename:       /in/esusW
function name:  (null)
number of ops:  37
compiled vars:  !0 = $originalString, !1 = $findStringArray, !2 = $words, !3 = $x, !4 = $value, !5 = $key, !6 = $newstring
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Her+%28III.1%29+was+the+age+of+2+years+and+11+months.+%28shoulder+a+4%2F5%29'
    4     1        ASSIGN                                                   !1, <array>
    5     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '+'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $9      
          6        ASSIGN                                                   !2, $9
    6     7        ASSIGN                                                   !3, 0
          8      > JMP                                                      ->27
    7     9    > > FE_RESET_R                                       $12     !1, ->25
         10    > > FE_FETCH_R                                       ~13     $12, !4, ->25
         11    >   ASSIGN                                                   !5, ~13
    8    12        INIT_FCALL                                               'preg_replace'
         13        INIT_FCALL                                               'preg_quote'
         14        SEND_VAR                                                 !4
         15        DO_ICALL                                         $15     
         16        CONCAT                                           ~16     '%2F%5Cb%28', $15
         17        CONCAT                                           ~17     ~16, '%29%5Cb%2Fi'
         18        SEND_VAL                                                 ~17
         19        SEND_VAL                                                 '__'
         20        FETCH_DIM_R                                      ~18     !2, !3
         21        SEND_VAL                                                 ~18
         22        DO_ICALL                                         $19     
         23        ASSIGN                                                   !0, $19
    7    24      > JMP                                                      ->10
         25    >   FE_FREE                                                  $12
    6    26        PRE_INC                                                  !3
         27    >   COUNT                                            ~22     !2
         28        IS_SMALLER                                               !3, ~22
         29      > JMPNZ                                                    ~23, ->9
   11    30    >   INIT_FCALL                                               'implode'
         31        SEND_VAL                                                 '+'
         32        SEND_VAR                                                 !2
         33        DO_ICALL                                         $24     
         34        ASSIGN                                                   !6, $24
   12    35        ECHO                                                     !6
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.18 ms | 1400 KiB | 21 Q