3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Derp implements Iterator { protected $index; protected $array; public function __construct(array $input) { $this->array = $input; } public function current() { return $this->array[$this->index]; } public function next() { $this->index += 1; } public function key() { return $this->index; } public function valid() { return isset($this->array[$this->index]); } public function rewind() { $this->index = 0; } } $d = new Derp(range(1,100)); var_dump(is_array($d)); foreach($d as $key => $value) { echo "$key => $value\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 22
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/HdDrl
function name:  (null)
number of ops:  24
compiled vars:  !0 = $d, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'derp'
   44     1        NEW                                              $3      'Derp'
          2        INIT_FCALL                                               'range'
          3        SEND_VAL                                                 1
          4        SEND_VAL                                                 100
          5        DO_ICALL                                         $4      
          6        SEND_VAR_NO_REF_EX                                       $4
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !0, $3
   46     9        INIT_FCALL                                               'var_dump'
         10        TYPE_CHECK                                  128  ~7      !0
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                                 
   48    13      > FE_RESET_R                                       $9      !0, ->22
         14    > > FE_FETCH_R                                       ~10     $9, !1, ->22
         15    >   ASSIGN                                                   !2, ~10
   49    16        ROPE_INIT                                     4  ~13     !2
         17        ROPE_ADD                                      1  ~13     ~13, '+%3D%3E+'
         18        ROPE_ADD                                      2  ~13     ~13, !1
         19        ROPE_END                                      3  ~12     ~13, '%0A'
         20        ECHO                                                     ~12
   48    21      > JMP                                                      ->14
         22    >   FE_FREE                                                  $9
   50    23      > RETURN                                                   1

Class Derp:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HdDrl
function name:  __construct
number of ops:  4
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        ASSIGN_OBJ                                               'array'
          2        OP_DATA                                                  !0
   11     3      > RETURN                                                   null

End of function __construct

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

End of function current

Function next:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HdDrl
function name:  next
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN_OBJ_OP                                 1          'index'
          1        OP_DATA                                                  1
   21     2      > RETURN                                                   null

End of function next

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

End of function key

Function valid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HdDrl
function name:  valid
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   FETCH_OBJ_R                                      ~1      'index'
          1        FETCH_OBJ_IS                                     ~0      'array'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~0, ~1
          3      > RETURN                                                   ~2
   33     4*     > RETURN                                                   null

End of function valid

Function rewind:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HdDrl
function name:  rewind
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   ASSIGN_OBJ                                               'index'
          1        OP_DATA                                                  0
   39     2      > RETURN                                                   null

End of function rewind

End of class Derp.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.28 ms | 1400 KiB | 17 Q