3v4l.org

run code in 300+ PHP versions simultaneously
<?php $firstName = 'Marc Jutten'; $str = '{{$firstName}}, {{$productName_67003}}'; if (preg_match_all('/{{\$productName_(\d{1,})}}/', $str, $matches)) { foreach ($matches[1] as $productIdKey => $productId) { $tst = str_replace( $matches[0][$productIdKey], '2 kaarten voor hét Nederlandse muziekfestival: Dutch Valley', $str ); } } if (preg_match_all('/{{\$(.*?)}}/', $tst, $matches)) { foreach ($matches[1] as $varKey => $varName) { $tst = str_replace($matches[0][$varKey], ${$varName}, $tst); } } echo $tst;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 22
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 43
Branch analysis from position: 28
2 jumps found. (Code = 77) Position 1 = 30, Position 2 = 42
Branch analysis from position: 30
2 jumps found. (Code = 78) Position 1 = 31, Position 2 = 42
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
Branch analysis from position: 43
Branch analysis from position: 21
Branch analysis from position: 22
filename:       /in/beJVT
function name:  (null)
number of ops:  45
compiled vars:  !0 = $firstName, !1 = $str, !2 = $matches, !3 = $productId, !4 = $productIdKey, !5 = $tst, !6 = $varName, !7 = $varKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Marc+Jutten'
    3     1        ASSIGN                                                   !1, '%7B%7B%24firstName%7D%7D%2C++%7B%7B%24productName_67003%7D%7D'
    4     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAL                                                 '%2F%7B%7B%5C%24productName_%28%5Cd%7B1%2C%7D%29%7D%7D%2F'
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $10     
          7      > JMPZ                                                     $10, ->22
    5     8    >   FETCH_DIM_R                                      ~11     !2, 1
          9      > FE_RESET_R                                       $12     ~11, ->21
         10    > > FE_FETCH_R                                       ~13     $12, !3, ->21
         11    >   ASSIGN                                                   !4, ~13
    7    12        INIT_FCALL                                               'str_replace'
    8    13        FETCH_DIM_R                                      ~15     !2, 0
         14        FETCH_DIM_R                                      ~16     ~15, !4
         15        SEND_VAL                                                 ~16
    9    16        SEND_VAL                                                 '2+kaarten+voor+h%C3%A9t+Nederlandse+muziekfestival%3A+Dutch+Valley'
   10    17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $17     
    7    19        ASSIGN                                                   !5, $17
    5    20      > JMP                                                      ->10
         21    >   FE_FREE                                                  $12
   14    22    >   INIT_FCALL                                               'preg_match_all'
         23        SEND_VAL                                                 '%2F%7B%7B%5C%24%28.%2A%3F%29%7D%7D%2F'
         24        SEND_VAR                                                 !5
         25        SEND_REF                                                 !2
         26        DO_ICALL                                         $19     
         27      > JMPZ                                                     $19, ->43
   15    28    >   FETCH_DIM_R                                      ~20     !2, 1
         29      > FE_RESET_R                                       $21     ~20, ->42
         30    > > FE_FETCH_R                                       ~22     $21, !6, ->42
         31    >   ASSIGN                                                   !7, ~22
   16    32        INIT_FCALL                                               'str_replace'
         33        FETCH_DIM_R                                      ~24     !2, 0
         34        FETCH_DIM_R                                      ~25     ~24, !7
         35        SEND_VAL                                                 ~25
         36        FETCH_R                      local               ~26     !6
         37        SEND_VAL                                                 ~26
         38        SEND_VAR                                                 !5
         39        DO_ICALL                                         $27     
         40        ASSIGN                                                   !5, $27
   15    41      > JMP                                                      ->30
         42    >   FE_FREE                                                  $21
   20    43    >   ECHO                                                     !5
         44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.09 ms | 1400 KiB | 17 Q