3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s = 'abc/{foo}/sdasd/{bar}'; $a = ['one', 'two']; do { $r = preg_replace('/\{*.\}/', array_shift($a), $s, 1); var_dump($r); } while ($r !== null);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
filename:       /in/cuHPY
function name:  (null)
number of ops:  18
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>
    6     2    >   INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%2F%5C%7B%2A.%5C%7D%2F'
          4        INIT_FCALL                                               'array_shift'
          5        SEND_REF                                                 !1
          6        DO_ICALL                                         $5      
          7        SEND_VAR                                                 $5
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 1
         10        DO_ICALL                                         $6      
         11        ASSIGN                                                   !2, $6
    7    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
    8    15        TYPE_CHECK                                  1020          !2
         16      > JMPNZ                                                    ~9, ->2
         17    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.64 ms | 1386 KiB | 19 Q