3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyThing implements \ArrayAccess { protected $storage = []; public function __construct($values = array()) { foreach ($values as $name => $value) { $this->offsetSet($name, $value); } } public function offsetGet($name) { if (isset($this->storage[$name])) { return $this->storage[$name]; } } public function offsetSet($name, $value) { $this->storage[$name] = $value; } public function offsetUnset($name) { unset($this->storage[$name]); } public function offsetExists($name) { return isset($this->storage[$name]); } } function printArray(array $a) { print_r($a); } $thing = new MyThing(['foo' => 'bar']); printArray($thing);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B3ngF
function name:  (null)
number of ops:  9
compiled vars:  !0 = $thing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'mything'
   36     1        NEW                                              $1      'MyThing'
          2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   37     5        INIT_FCALL                                               'printarray'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function printarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B3ngF
function name:  printArray
number of ops:  5
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
   33     1        INIT_FCALL                                               'print_r'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   34     4      > RETURN                                                   null

End of function printarray

Class MyThing:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 9
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/B3ngF
function name:  __construct
number of ops:  11
compiled vars:  !0 = $values, !1 = $value, !2 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV_INIT                                        !0      <array>
    7     1      > FE_RESET_R                                       $3      !0, ->9
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->9
          3    >   ASSIGN                                                   !2, ~4
    8     4        INIT_METHOD_CALL                                         'offsetSet'
          5        SEND_VAR_EX                                              !2
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
    7     8      > JMP                                                      ->2
          9    >   FE_FREE                                                  $3
   10    10      > RETURN                                                   null

End of function __construct

Function offsetget:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B3ngF
function name:  offsetGet
number of ops:  8
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        FETCH_OBJ_IS                                     ~1      'storage'
          2        ISSET_ISEMPTY_DIM_OBJ                         0          ~1, !0
          3      > JMPZ                                                     ~2, ->7
   14     4    >   FETCH_OBJ_R                                      ~3      'storage'
          5        FETCH_DIM_R                                      ~4      ~3, !0
          6      > RETURN                                                   ~4
   16     7    > > RETURN                                                   null

End of function offsetget

Function offsetset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B3ngF
function name:  offsetSet
number of ops:  6
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        FETCH_OBJ_W                                      $2      'storage'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   20     5      > RETURN                                                   null

End of function offsetset

Function offsetunset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B3ngF
function name:  offsetUnset
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        FETCH_OBJ_UNSET                                  $1      'storage'
          2        UNSET_DIM                                                $1, !0
   24     3      > RETURN                                                   null

End of function offsetunset

Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B3ngF
function name:  offsetExists
number of ops:  5
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   27     1        FETCH_OBJ_IS                                     ~1      'storage'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, !0
          3      > RETURN                                                   ~2
   28     4*     > RETURN                                                   null

End of function offsetexists

End of class MyThing.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.14 ms | 1403 KiB | 16 Q