3v4l.org

run code in 300+ PHP versions simultaneously
<?php function stringInterpolate($str, array $vars) { return preg_replace_callback('/\{\$(\w+)\}/', function($matches){ return $matches[0]; }, $str); } echo stringInterpolate('{$name} {$surname}', array('name' => 'foo', 'surname' => 'Bar'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Vu2TA
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'stringinterpolate'
          1        SEND_VAL                                                 '%7B%24name%7D+%7B%24surname%7D'
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function stringinterpolate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Vu2TA
function name:  stringInterpolate
number of ops:  10
compiled vars:  !0 = $str, !1 = $vars
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'preg_replace_callback'
          3        SEND_VAL                                                 '%2F%5C%7B%5C%24%28%5Cw%2B%29%5C%7D%2F'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FVu2TA%3A5%240'
    7     5        SEND_VAL                                                 ~2
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8      > RETURN                                                   $3
    8     9*     > RETURN                                                   null

End of function stringinterpolate

Function %00%7Bclosure%7D%2Fin%2FVu2TA%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Vu2TA
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        FETCH_DIM_R                                      ~1      !0, 0
          2      > RETURN                                                   ~1
    7     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FVu2TA%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.24 ms | 1398 KiB | 16 Q