3v4l.org

run code in 300+ PHP versions simultaneously
<?php $options = [ "site" => "Smartprix", "users" => [ 10 => [ "name" => "Hitesh", "city" => "Delhi" ], 34 => [ "name" => "Abhinav", "city" => "Bharatpur" ], ], "location" => [ "address" => [ "pincode" => "110035", "city" => "Delhi", ], "near" => "Shastri Nagar Metro", ], ]; $options=json_encode($options); $template = "{{=site}} is located at pincode {{=location.address.pincode}} near {{=location.near}}. Users of {{=site}} are: {{@users}} User ID: {{=_key}}, name: {{=_val.name}}, city: {{=_val.city}}. {{/@users}}"; function render($string, $options) { $array= array(); preg_match_all("/\{{=(.*?)}}/",$string,$array); //var_dump($array); die; var_dump($options.$array[1][1]); die; } echo render($template, $options); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YDeut
function name:  (null)
number of ops:  12
compiled vars:  !0 = $options, !1 = $template
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   22     1        INIT_FCALL                                               'json_encode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
   23     5        ASSIGN                                                   !1, '%7B%7B%3Dsite%7D%7D+is+located+at+pincode+%7B%7B%3Dlocation.address.pincode%7D%7D+near%0A%7B%7B%3Dlocation.near%7D%7D.+Users+of+%7B%7B%3Dsite%7D%7D+are%3A+%7B%7B%40users%7D%7D+User+ID%3A+%7B%7B%3D_key%7D%7D%2C+name%3A+%7B%7B%3D_val.name%7D%7D%2C%0Acity%3A+%7B%7B%3D_val.city%7D%7D.+%7B%7B%2F%40users%7D%7D'
   34     6        INIT_FCALL                                               'render'
          7        SEND_VAR                                                 !1
          8        SEND_VAR                                                 !0
          9        DO_FCALL                                      0  $6      
         10        ECHO                                                     $6
   36    11      > RETURN                                                   1

Function render:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/YDeut
function name:  render
number of ops:  16
compiled vars:  !0 = $string, !1 = $options, !2 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   28     2        ASSIGN                                                   !2, <array>
   29     3        INIT_FCALL                                               'preg_match_all'
          4        SEND_VAL                                                 '%2F%5C%7B%7B%3D%28.%2A%3F%29%7D%7D%2F'
          5        SEND_VAR                                                 !0
          6        SEND_REF                                                 !2
          7        DO_ICALL                                                 
   31     8        INIT_FCALL                                               'var_dump'
          9        FETCH_DIM_R                                      ~5      !2, 1
         10        FETCH_DIM_R                                      ~6      ~5, 1
         11        CONCAT                                           ~7      !1, ~6
         12        SEND_VAL                                                 ~7
         13        DO_ICALL                                                 
         14      > EXIT                                                     
   33    15*     > RETURN                                                   null

End of function render

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.64 ms | 1399 KiB | 20 Q