3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [0,1,2,null,3]; foreach($a as $k => $v){ echo $v; } echo "\n"; class Test implements Iterator { private $p = 0; private $a = [0,1,2,null,3]; public function __construct() { array_unshift( $this->a, 8 ); } function rewind() { $this->p = 0; } function current() { return $this->a[$this->p]; } function key() { return $this->p; } function next() { ++$this->p; } function valid() { return isset( $this->a[$this->p] ); } } $it = new Test; foreach($it as $k => $v) { echo $v; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 6
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
Branch analysis from position: 6
filename:       /in/jSlB9
function name:  (null)
number of ops:  19
compiled vars:  !0 = $a, !1 = $v, !2 = $k, !3 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1      > FE_RESET_R                                       $5      !0, ->6
          2    > > FE_FETCH_R                                       ~6      $5, !1, ->6
          3    >   ASSIGN                                                   !2, ~6
    5     4        ECHO                                                     !1
    4     5      > JMP                                                      ->2
          6    >   FE_FREE                                                  $5
    7     7        ECHO                                                     '%0A'
    9     8        DECLARE_CLASS                                            'test'
   38     9        NEW                                              $8      'Test'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !3, $8
   40    12      > FE_RESET_R                                       $11     !3, ->17
         13    > > FE_FETCH_R                                       ~12     $11, !1, ->17
         14    >   ASSIGN                                                   !2, ~12
   41    15        ECHO                                                     !1
   40    16      > JMP                                                      ->13
         17    >   FE_FREE                                                  $11
   43    18      > RETURN                                                   1

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jSlB9
function name:  __construct
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'array_unshift'
          1        FETCH_OBJ_W                                      $0      'a'
          2        SEND_REF                                                 $0
          3        SEND_VAL                                                 8
          4        DO_ICALL                                                 
   15     5      > RETURN                                                   null

End of function __construct

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

End of function rewind

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

End of function current

Function key:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jSlB9
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      'p'
          1      > RETURN                                                   ~0
   27     2*     > RETURN                                                   null

End of function key

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

End of function next

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

End of function valid

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.51 ms | 1400 KiB | 15 Q