3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Shiterator implements Iterator { private $_array = array(); public function __construct(array $array) { $this->_array = $array; } public function rewind() { reset($this->_array); } public function current() { return current($this->_array); } public function key() { return key($this->_array); } public function next() { next($this->_array); } public function valid() { return $this->key() !== null; } } $stdcls = new stdClass(); $stdcls->message = 'PHP, still a peice of shit.'; $i = new Shiterator(array($stdcls)); foreach ($i as $t) { echo $stdcls->message; $stdcls->message = 'Zend still produces garbage.'; } var_dump($i);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/5E7kS
function name:  (null)
number of ops:  23
compiled vars:  !0 = $stdcls, !1 = $i, !2 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'shiterator'
   30     1        NEW                                              $3      'stdClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   31     4        ASSIGN_OBJ                                               !0, 'message'
          5        OP_DATA                                                  'PHP%2C+still+a+peice+of+shit.'
   33     6        NEW                                              $7      'Shiterator'
          7        INIT_ARRAY                                       ~8      !0
          8        SEND_VAL_EX                                              ~8
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $7
   35    11      > FE_RESET_R                                       $11     !1, ->18
         12    > > FE_FETCH_R                                               $11, !2, ->18
   36    13    >   FETCH_OBJ_R                                      ~12     !0, 'message'
         14        ECHO                                                     ~12
   38    15        ASSIGN_OBJ                                               !0, 'message'
         16        OP_DATA                                                  'Zend+still+produces+garbage.'
   35    17      > JMP                                                      ->12
         18    >   FE_FREE                                                  $11
   41    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Class Shiterator:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5E7kS
function name:  __construct
number of ops:  4
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               '_array'
          2        OP_DATA                                                  !0
    7     3      > 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/5E7kS
function name:  rewind
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'reset'
          1        FETCH_OBJ_W                                      $0      '_array'
          2        SEND_REF                                                 $0
          3        DO_ICALL                                                 
   11     4      > 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/5E7kS
function name:  current
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'current'
          1        FETCH_OBJ_R                                      ~0      '_array'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   15     5*     > 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/5E7kS
function name:  key
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'key'
          1        FETCH_OBJ_R                                      ~0      '_array'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   19     5*     > 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/5E7kS
function name:  next
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'next'
          1        FETCH_OBJ_W                                      $0      '_array'
          2        SEND_REF                                                 $0
          3        DO_ICALL                                                 
   23     4      > 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/5E7kS
function name:  valid
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_METHOD_CALL                                         'key'
          1        DO_FCALL                                      0  $0      
          2        TYPE_CHECK                                  1020  ~1      $0
          3      > RETURN                                                   ~1
   27     4*     > RETURN                                                   null

End of function valid

End of class Shiterator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.28 ms | 1392 KiB | 23 Q