3v4l.org

run code in 300+ PHP versions simultaneously
<?php function interpolate($str, $data) { // /var/storage/images/strip/' .$hash . '/tn_' . $n . '.jpg'; array_walk($data, function($value, $key) use ($str) { $str = str_replace('{{' . $key . '}}', $value, $str); }); return $str; } $str = '/var/storage/images/strip/{{hash}}/tn_{{n}}.jpg'; echo interpolate($str, array('hash' => '0238de39s82u4d30238de39s82u4d3', 'n' => 1));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JkWUD
function name:  (null)
number of ops:  7
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, '%2Fvar%2Fstorage%2Fimages%2Fstrip%2F%7B%7Bhash%7D%7D%2Ftn_%7B%7Bn%7D%7D.jpg'
   14     1        INIT_FCALL                                               'interpolate'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <array>
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6      > RETURN                                                   1

Function interpolate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JkWUD
function name:  interpolate
number of ops:  10
compiled vars:  !0 = $str, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'array_walk'
          3        SEND_REF                                                 !1
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FJkWUD%3A5%240'
          5        BIND_LEXICAL                                             ~2, !0
    7     6        SEND_VAL                                                 ~2
          7        DO_ICALL                                                 
    8     8      > RETURN                                                   !0
    9     9*     > RETURN                                                   null

End of function interpolate

Function %00%7Bclosure%7D%2Fin%2FJkWUD%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JkWUD
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $value, !1 = $key, !2 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    6     3        INIT_FCALL                                               'str_replace'
          4        CONCAT                                           ~3      '%7B%7B', !1
          5        CONCAT                                           ~4      ~3, '%7D%7D'
          6        SEND_VAL                                                 ~4
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                         $5      
         10        ASSIGN                                                   !2, $5
    7    11      > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.92 ms | 1390 KiB | 18 Q