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', "__", $originalString); #if ($words[$x] == $value) { # $words[$x] = preg_replace('/\b('.preg_quote($value).')\b/i', "__", $words[$x]); #} } #} $newstring = implode(" ", $words); echo $newstring;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 22
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 22
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/io6AR
function name:  (null)
number of ops:  30
compiled vars:  !0 = $originalString, !1 = $findStringArray, !2 = $words, !3 = $value, !4 = $key, !5 = $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                                         $8      
          6        ASSIGN                                                   !2, $8
    7     7      > FE_RESET_R                                       $10     !1, ->22
          8    > > FE_FETCH_R                                       ~11     $10, !3, ->22
          9    >   ASSIGN                                                   !4, ~11
    8    10        INIT_FCALL                                               'preg_replace'
         11        INIT_FCALL                                               'preg_quote'
         12        SEND_VAR                                                 !3
         13        DO_ICALL                                         $13     
         14        CONCAT                                           ~14     '%2F%5Cb%28', $13
         15        CONCAT                                           ~15     ~14, '%29%5Cb%2Fi'
         16        SEND_VAL                                                 ~15
         17        SEND_VAL                                                 '__'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $16     
         20        ASSIGN                                                   !0, $16
    7    21      > JMP                                                      ->8
         22    >   FE_FREE                                                  $10
   14    23        INIT_FCALL                                               'implode'
         24        SEND_VAL                                                 '+'
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                         $18     
         27        ASSIGN                                                   !5, $18
   15    28        ECHO                                                     !5
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.93 ms | 1396 KiB | 21 Q