3v4l.org

run code in 300+ PHP versions simultaneously
<?php $clasa = 'HHH'; $length = '100'; $width = 200; $depth = 300; $string1 = '{{clasa}}{{length}}{{width}}'; $string2 = '{{clasa}}{{lenght}}{{depth}}'; $string3 = '{{clasa}}_word{{lenght}},anything{{depth}}'; //$new1 = preg_replace('/{{([a-zA-Z\_\-]*?)}}/', ${'"$1"'}, $string1); $new1 = preg_replace_callback("/{{([a-zA-Z\_\-]*?)}}/", function($m){ global ${$m["1"]}; return ${$m["1"]}; }, $string1); echo $new1;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iqalh
function name:  (null)
number of ops:  16
compiled vars:  !0 = $clasa, !1 = $length, !2 = $width, !3 = $depth, !4 = $string1, !5 = $string2, !6 = $string3, !7 = $new1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'HHH'
    4     1        ASSIGN                                                   !1, '100'
    5     2        ASSIGN                                                   !2, 200
    6     3        ASSIGN                                                   !3, 300
    9     4        ASSIGN                                                   !4, '%7B%7Bclasa%7D%7D%7B%7Blength%7D%7D%7B%7Bwidth%7D%7D'
   10     5        ASSIGN                                                   !5, '%7B%7Bclasa%7D%7D%7B%7Blenght%7D%7D%7B%7Bdepth%7D%7D'
   11     6        ASSIGN                                                   !6, '%7B%7Bclasa%7D%7D_word%7B%7Blenght%7D%7D%2Canything%7B%7Bdepth%7D%7D'
   14     7        INIT_FCALL                                               'preg_replace_callback'
          8        SEND_VAL                                                 '%2F%7B%7B%28%5Ba-zA-Z%5C_%5C-%5D%2A%3F%29%7D%7D%2F'
          9        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fiqalh%3A14%240'
   17    10        SEND_VAL                                                 ~15
         11        SEND_VAR                                                 !4
         12        DO_ICALL                                         $16     
   14    13        ASSIGN                                                   !7, $16
   19    14        ECHO                                                     !7
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fiqalh%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iqalh
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        FETCH_DIM_R                                      ~1      !0, 1
          2        FETCH_W                      global lock         $2      ~1
          3        FETCH_W                      local               $3      ~1
          4        ASSIGN_REF                                               $3, $2
   16     5        FETCH_DIM_R                                      ~4      !0, 1
          6        FETCH_R                      local               ~5      ~4
          7      > RETURN                                                   ~5
   17     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fiqalh%3A14%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.55 ms | 1396 KiB | 15 Q