3v4l.org

run code in 300+ PHP versions simultaneously
<?php class InfiniteNumbers implements Iterator { public $start; public $current; public function __construct($start) { $this->start = $start; $this->current = $start; } public function next() { $this->current++; } public function current() { return $this->current; } public function key() { return $this->current; } public function rewind() { $this->current = $this->start; } public function valid() { return true; } } $infinite = new InfiniteNumbers(1); var_dump($infinite); /* foreach($infinite as $number) { if($number > 1000) { break; } echo $number."\n"; } */
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ElZfK
function name:  (null)
number of ops:  9
compiled vars:  !0 = $infinite
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'infinitenumbers'
   32     1        NEW                                              $1      'InfiniteNumbers'
          2        SEND_VAL_EX                                              1
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   34     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   43     8      > RETURN                                                   1

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

End of function __construct

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

End of function next

Function current:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ElZfK
function name:  current
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_OBJ_R                                      ~0      'current'
          1      > RETURN                                                   ~0
   17     2*     > 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/ElZfK
function name:  key
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   FETCH_OBJ_R                                      ~0      'current'
          1      > RETURN                                                   ~0
   21     2*     > RETURN                                                   null

End of function key

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

End of function rewind

Function valid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ElZfK
function name:  valid
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E > > RETURN                                                   <true>
   29     1*     > RETURN                                                   null

End of function valid

End of class InfiniteNumbers.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.97 ms | 1400 KiB | 15 Q