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", ], ]; $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["location"]["address"]); die; } echo render($template, $options); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0IkS4
function name:  (null)
number of ops:  8
compiled vars:  !0 = $options, !1 = $template
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   22     1        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'
   33     2        INIT_FCALL                                               'render'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
   35     7      > RETURN                                                   1

Function render:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/0IkS4
function name:  render
number of ops:  15
compiled vars:  !0 = $string, !1 = $options, !2 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   27     2        ASSIGN                                                   !2, <array>
   28     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                                                 
   30     8        INIT_FCALL                                               'var_dump'
          9        FETCH_DIM_R                                      ~5      !1, 'location'
         10        FETCH_DIM_R                                      ~6      ~5, 'address'
         11        SEND_VAL                                                 ~6
         12        DO_ICALL                                                 
         13      > EXIT                                                     
   32    14*     > RETURN                                                   null

End of function render

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.92 ms | 1398 KiB | 18 Q