3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s = 'abc/{foo}/sdasd/{bar}'; $a = ['one', 'two']; $r = ''; do { $r = preg_replace('/\{*.\}/', array_shift($a), $s, 1); var_dump($r); } while ($r !== null); echo 'Done!';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 3
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
filename:       /in/DOgFR
function name:  (null)
number of ops:  20
compiled vars:  !0 = $s, !1 = $a, !2 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'abc%2F%7Bfoo%7D%2Fsdasd%2F%7Bbar%7D'
    3     1        ASSIGN                                                   !1, <array>
    4     2        ASSIGN                                                   !2, ''
    7     3    >   INIT_FCALL                                               'preg_replace'
          4        SEND_VAL                                                 '%2F%5C%7B%2A.%5C%7D%2F'
          5        INIT_FCALL                                               'array_shift'
          6        SEND_REF                                                 !1
          7        DO_ICALL                                         $6      
          8        SEND_VAR                                                 $6
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 1
         11        DO_ICALL                                         $7      
         12        ASSIGN                                                   !2, $7
    8    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
    9    16        TYPE_CHECK                                  1020          !2
         17      > JMPNZ                                                    ~10, ->3
   11    18    >   ECHO                                                     'Done%21'
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.28 ms | 1395 KiB | 19 Q