3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo implements \IteratorAggregate, \ArrayAccess, \Countable { private $data = [1,2,3]; public function getIterator() { return new \ArrayIterator($this->data); } public function count() { return count($this->data); } public function offsetExists($offset) { return isset($this->data[$offset]); } public function offsetGet($offset) { return $this->data[$offset]; } public function offsetSet($offset, $value) { $this->data[$offset] = $value; } public function offsetUnset($offset) { unset($this->data[$offset]); } } foreach ((new \ArrayObject(new Foo)) as $key => $value) { var_dump($key, $value); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/cIAD5
function name:  (null)
number of ops:  16
compiled vars:  !0 = $value, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'foo'
   38     1        NEW                                              $2      'ArrayObject'
          2        NEW                                              $3      'Foo'
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $3
          5        DO_FCALL                                      0          
          6      > FE_RESET_R                                       $6      $2, ->14
          7    > > FE_FETCH_R                                       ~7      $6, !0, ->14
          8    >   ASSIGN                                                   !1, ~7
   39     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
   38    13      > JMP                                                      ->7
         14    >   FE_FREE                                                  $6
   40    15      > RETURN                                                   1

Class Foo:
Function getiterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cIAD5
function name:  getIterator
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $0      'ArrayIterator'
          1        CHECK_FUNC_ARG                                           
          2        FETCH_OBJ_FUNC_ARG                               $1      'data'
          3        SEND_FUNC_ARG                                            $1
          4        DO_FCALL                                      0          
          5      > RETURN                                                   $0
   10     6*     > RETURN                                                   null

End of function getiterator

Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cIAD5
function name:  count
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'data'
          1        COUNT                                            ~1      ~0
          2      > RETURN                                                   ~1
   15     3*     > RETURN                                                   null

End of function count

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

End of function offsetexists

Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cIAD5
function name:  offsetGet
number of ops:  5
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   24     1        FETCH_OBJ_R                                      ~1      'data'
          2        FETCH_DIM_R                                      ~2      ~1, !0
          3      > RETURN                                                   ~2
   25     4*     > 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/cIAD5
function name:  offsetSet
number of ops:  6
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   29     2        FETCH_OBJ_W                                      $2      'data'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   30     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/cIAD5
function name:  offsetUnset
number of ops:  4
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
   34     1        FETCH_OBJ_UNSET                                  $1      'data'
          2        UNSET_DIM                                                $1, !0
   35     3      > RETURN                                                   null

End of function offsetunset

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.84 ms | 1400 KiB | 15 Q