3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = <<<EOT etc etc etc content [crowdpdf-total=field_585b0b3288d2e] etc etc [crowdpdf-total=field_585b0b3288d2f] etc content EOT; $replacements = [ 'field_585b0b3288d2e'=> 864, 'field_585b0b3288d2f' => 987, ]; foreach ($replacements as $find => $replace) { $string = str_replace("[crowdpdf-total=$find]", $replace, $string); } echo $string;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/i4L1u
function name:  (null)
number of ops:  18
compiled vars:  !0 = $string, !1 = $replacements, !2 = $replace, !3 = $find
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'etc+etc+etc+content%0A%5Bcrowdpdf-total%3Dfield_585b0b3288d2e%5D+%0Aetc+etc+%5Bcrowdpdf-total%3Dfield_585b0b3288d2f%5D+%0Aetc+content'
   10     1        ASSIGN                                                   !1, <array>
   15     2      > FE_RESET_R                                       $6      !1, ->15
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->15
          4    >   ASSIGN                                                   !3, ~7
   16     5        INIT_FCALL                                               'str_replace'
          6        ROPE_INIT                                     3  ~10     '%5Bcrowdpdf-total%3D'
          7        ROPE_ADD                                      1  ~10     ~10, !3
          8        ROPE_END                                      2  ~9      ~10, '%5D'
          9        SEND_VAL                                                 ~9
         10        SEND_VAR                                                 !2
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $12     
         13        ASSIGN                                                   !0, $12
   15    14      > JMP                                                      ->3
         15    >   FE_FREE                                                  $6
   19    16        ECHO                                                     !0
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.92 ms | 1405 KiB | 15 Q