3v4l.org

run code in 500+ PHP versions simultaneously
<?php namespace App\Support; use ArrayObject; final class Config extends ArrayObject { } $settings = [ 'section' => [ 'key1' => 'my_value_1', 'key2' => 'my_value_2', ], ]; $config = new Config($settings); //$config->setFlags(ArrayObject::ARRAY_AS_PROPS); print_r($config['section']); final class MyExample { private Config $config; public function __construct(Config $config) { $this->config = $config; } public function doSomething(): void { $value1 = $this->config['section']['key1']; // Output: my_value_1 echo $value1; } } $example = new MyExample($config); $example->doSomething();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iqocf
function name:  (null)
number of ops:  17
compiled vars:  !0 = $settings, !1 = $config, !2 = $example
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                       !0, <array>
   19     1        NEW                                                  $4      'App%5CSupport%5CConfig'
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !1, $4
   22     5        INIT_NS_FCALL_BY_NAME                                        'App%5CSupport%5Cprint_r'
          6        CHECK_FUNC_ARG                                               
          7        FETCH_DIM_FUNC_ARG                                   $7      !1, 'section'
          8        SEND_FUNC_ARG                                                $7
          9        DO_FCALL                                          0          
   42    10        NEW                                                  $9      'App%5CSupport%5CMyExample'
         11        SEND_VAR_EX                                                  !1
         12        DO_FCALL                                          0          
         13        ASSIGN                                                       !2, $9
   43    14        INIT_METHOD_CALL                                             !2, 'doSomething'
         15        DO_FCALL                                          0          
         16      > RETURN                                                       1

Class App\Support\Config: [no user functions]
Class App\Support\MyExample:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iqocf
function name:  __construct
number of ops:  4
compiled vars:  !0 = $config
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   RECV                                                 !0      
   30     1        ASSIGN_OBJ                                                   'config'
          2        OP_DATA                                                      !0
   31     3      > RETURN                                                       null

End of function __construct

Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iqocf
function name:  doSomething
number of ops:  6
compiled vars:  !0 = $value1
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   FETCH_OBJ_R                                          ~1      'config'
          1        FETCH_DIM_R                                          ~2      ~1, 'section'
          2        FETCH_DIM_R                                          ~3      ~2, 'key1'
          3        ASSIGN                                                       !0, ~3
   38     4        ECHO                                                         !0
   39     5      > RETURN                                                       null

End of function dosomething

End of class App\Support\MyExample.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
178.73 ms | 1652 KiB | 14 Q