3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tst = '!!!!'; $a = '@@@'; $template = '{{$tst}}test{{$a}}'; $x = preg_match_all('/{{\$(.*?)}}/', $template, $m); echo $x; if ($x) { print_r($m); foreach ($m[1] as $i => $varname) { echo strval($varname).PHP_EOL.$m[0][$i].'===='.sprintf('$%s', $varname).PHP_EOL; $template = str_replace($m[0][$i], $$varname, $template); } } echo $template;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 42
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 41
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 41
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
Branch analysis from position: 42
filename:       /in/vOQgq
function name:  (null)
number of ops:  44
compiled vars:  !0 = $tst, !1 = $a, !2 = $template, !3 = $x, !4 = $m, !5 = $varname, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%21%21%21%21'
    4     1        ASSIGN                                                   !1, '%40%40%40'
    5     2        ASSIGN                                                   !2, '%7B%7B%24tst%7D%7Dtest%7B%7B%24a%7D%7D'
    7     3        INIT_FCALL                                               'preg_match_all'
          4        SEND_VAL                                                 '%2F%7B%7B%5C%24%28.%2A%3F%29%7D%7D%2F'
          5        SEND_VAR                                                 !2
          6        SEND_REF                                                 !4
          7        DO_ICALL                                         $10     
          8        ASSIGN                                                   !3, $10
    8     9        ECHO                                                     !3
    9    10      > JMPZ                                                     !3, ->42
   10    11    >   INIT_FCALL                                               'print_r'
         12        SEND_VAR                                                 !4
         13        DO_ICALL                                                 
   11    14        FETCH_DIM_R                                      ~13     !4, 1
         15      > FE_RESET_R                                       $14     ~13, ->41
         16    > > FE_FETCH_R                                       ~15     $14, !5, ->41
         17    >   ASSIGN                                                   !6, ~15
   12    18        CAST                                          6  ~17     !5
         19        CONCAT                                           ~18     ~17, '%0A'
         20        FETCH_DIM_R                                      ~19     !4, 0
         21        FETCH_DIM_R                                      ~20     ~19, !6
         22        CONCAT                                           ~21     ~18, ~20
         23        CONCAT                                           ~22     ~21, '%3D%3D%3D%3D'
         24        INIT_FCALL                                               'sprintf'
         25        SEND_VAL                                                 '%24%25s'
         26        SEND_VAR                                                 !5
         27        DO_ICALL                                         $23     
         28        CONCAT                                           ~24     ~22, $23
         29        CONCAT                                           ~25     ~24, '%0A'
         30        ECHO                                                     ~25
   13    31        INIT_FCALL                                               'str_replace'
         32        FETCH_DIM_R                                      ~26     !4, 0
         33        FETCH_DIM_R                                      ~27     ~26, !6
         34        SEND_VAL                                                 ~27
         35        FETCH_R                      local               ~28     !5
         36        SEND_VAL                                                 ~28
         37        SEND_VAR                                                 !2
         38        DO_ICALL                                         $29     
         39        ASSIGN                                                   !2, $29
   11    40      > JMP                                                      ->16
         41    >   FE_FREE                                                  $14
   16    42    >   ECHO                                                     !2
         43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.21 ms | 1400 KiB | 21 Q