3v4l.org

run code in 300+ PHP versions simultaneously
<?php $code = "[gallery-1] <p>Test...test...test...</p> [gallery-2]"; preg_match_all("/\[gallery-([1-9])\]/", $code, $matches); $galleries = []; foreach ($matches[1] as $id) { $galleries[$id] = 'x'; // Somehow load a gallery basing on id; } foreach ($galleries as $id => $sub) { $code = str_ireplace("[gallery-" . $id . "]", $sub, $code); } echo $code;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 26
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 26
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 13
filename:       /in/GOARN
function name:  (null)
number of ops:  29
compiled vars:  !0 = $code, !1 = $matches, !2 = $galleries, !3 = $id, !4 = $sub
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5Bgallery-1%5D+%3Cp%3ETest...test...test...%3C%2Fp%3E+%5Bgallery-2%5D'
    5     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%5C%5Bgallery-%28%5B1-9%5D%29%5C%5D%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    7     6        ASSIGN                                                   !2, <array>
    9     7        FETCH_DIM_R                                      ~8      !1, 1
          8      > FE_RESET_R                                       $9      ~8, ->13
          9    > > FE_FETCH_R                                               $9, !3, ->13
   10    10    >   ASSIGN_DIM                                               !2, !3
         11        OP_DATA                                                  'x'
    9    12      > JMP                                                      ->9
         13    >   FE_FREE                                                  $9
   13    14      > FE_RESET_R                                       $11     !2, ->26
         15    > > FE_FETCH_R                                       ~12     $11, !4, ->26
         16    >   ASSIGN                                                   !3, ~12
   14    17        INIT_FCALL                                               'str_ireplace'
         18        CONCAT                                           ~14     '%5Bgallery-', !3
         19        CONCAT                                           ~15     ~14, '%5D'
         20        SEND_VAL                                                 ~15
         21        SEND_VAR                                                 !4
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $16     
         24        ASSIGN                                                   !0, $16
   13    25      > JMP                                                      ->15
         26    >   FE_FREE                                                  $11
   17    27        ECHO                                                     !0
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.22 ms | 1396 KiB | 17 Q