3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = (object)[ "svg" => (array)[ (object)[], (object)[ "linearGradient" => [ (object)[ "@style" => "testing", ], ], ], ], ]; $str = "svg.1.linearGradient.0.@style"; $keys = explode('.', $str); $val = $arr; foreach($keys as $key) { $val = is_object($val) ? $val->$key : $val[$key]; } echo $val;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 29
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 29
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/h8YPv
function name:  (null)
number of ops:  32
compiled vars:  !0 = $arr, !1 = $str, !2 = $keys, !3 = $val, !4 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   CAST                                              8  ~5      <array>
          1        INIT_ARRAY                                           ~6      ~5
          2        CAST                                              8  ~7      <array>
          3        INIT_ARRAY                                           ~8      ~7
          4        INIT_ARRAY                                           ~9      ~8, 'linearGradient'
          5        CAST                                              8  ~10     ~9
          6        ADD_ARRAY_ELEMENT                                    ~6      ~10
          7        CAST                                              7  ~11     ~6
          8        INIT_ARRAY                                           ~12     ~11, 'svg'
          9        CAST                                              8  ~13     ~12
    3    10        ASSIGN                                                       !0, ~13
   16    11        ASSIGN                                                       !1, 'svg.1.linearGradient.0.%40style'
   17    12        INIT_FCALL                                                   'explode'
         13        SEND_VAL                                                     '.'
         14        SEND_VAR                                                     !1
         15        DO_ICALL                                             $16     
         16        ASSIGN                                                       !2, $16
   18    17        ASSIGN                                                       !3, !0
   19    18      > FE_RESET_R                                           $19     !2, ->29
         19    > > FE_FETCH_R                                                   $19, !4, ->29
   20    20    >   TYPE_CHECK                                      256          !3
         21      > JMPZ                                                         ~20, ->25
   21    22    >   FETCH_OBJ_R                                          ~21     !3, !4
         23        QM_ASSIGN                                            ~22     ~21
         24      > JMP                                                          ->27
   22    25    >   FETCH_DIM_R                                          ~23     !3, !4
         26        QM_ASSIGN                                            ~22     ~23
   20    27    >   ASSIGN                                                       !3, ~22
   19    28      > JMP                                                          ->19
         29    >   FE_FREE                                                      $19
   25    30        ECHO                                                         !3
   26    31      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.16 ms | 2014 KiB | 14 Q