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' . $id; // 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 = 14
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 14
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 27
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 27
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 14
filename:       /in/1kltl
function name:  (null)
number of ops:  30
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, ->14
          9    > > FE_FETCH_R                                               $9, !3, ->14
   10    10    >   CONCAT                                           ~11     'x', !3
         11        ASSIGN_DIM                                               !2, !3
         12        OP_DATA                                                  ~11
    9    13      > JMP                                                      ->9
         14    >   FE_FREE                                                  $9
   13    15      > FE_RESET_R                                       $12     !2, ->27
         16    > > FE_FETCH_R                                       ~13     $12, !4, ->27
         17    >   ASSIGN                                                   !3, ~13
   14    18        INIT_FCALL                                               'str_ireplace'
         19        CONCAT                                           ~15     '%5Bgallery-', !3
         20        CONCAT                                           ~16     ~15, '%5D'
         21        SEND_VAL                                                 ~16
         22        SEND_VAR                                                 !4
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $17     
         25        ASSIGN                                                   !0, $17
   13    26      > JMP                                                      ->16
         27    >   FE_FREE                                                  $12
   17    28        ECHO                                                     !0
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.76 ms | 1396 KiB | 17 Q