3v4l.org

run code in 300+ PHP versions simultaneously
<?php class values implements IteratorAggregate { protected $iterator = null; protected $data = null; public function __construct($data) { $this->data = $data; } public function getIterator() { if (null === $this->iterator){ if(is_array($this->data)) { $this->iterator = new ArrayObject($this->data); } else if(is_object($this->data)) { $this->iterator = new ArrayObject(get_object_vars($this->data)); } else { throw new Exception('$objOrArray is neither an array or an object'); } } return $this->iterator; } } $values = new values(new DateTime()); for ($i = 0; $i < 100; $i++){ foreach($values as $k => $v) { var_dump($k, $v); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 9
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 9
Branch analysis from position: 21
Branch analysis from position: 9
Branch analysis from position: 17
filename:       /in/BC4De
function name:  (null)
number of ops:  22
compiled vars:  !0 = $values, !1 = $i, !2 = $v, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'values'
   27     1        NEW                                              $4      'values'
          2        NEW                                              $5      'DateTime'
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $5
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $4
   29     7        ASSIGN                                                   !1, 0
          8      > JMP                                                      ->19
   30     9    > > FE_RESET_R                                       $10     !0, ->17
         10    > > FE_FETCH_R                                       ~11     $10, !2, ->17
         11    >   ASSIGN                                                   !3, ~11
   31    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !3
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
   30    16      > JMP                                                      ->10
         17    >   FE_FREE                                                  $10
   29    18        PRE_INC                                                  !1
         19    >   IS_SMALLER                                               !1, 100
         20      > JMPNZ                                                    ~15, ->9
   33    21    > > RETURN                                                   1

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

End of function __construct

Function getiterator:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 31
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 27
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 27
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 31
filename:       /in/BC4De
function name:  getIterator
number of ops:  34
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'iterator'
          1        TYPE_CHECK                                    2          ~0
          2      > JMPZ                                                     ~1, ->31
   15     3    >   FETCH_OBJ_R                                      ~2      'data'
          4        TYPE_CHECK                                  128          ~2
          5      > JMPZ                                                     ~3, ->14
   16     6    >   NEW                                              $5      'ArrayObject'
          7        CHECK_FUNC_ARG                                           
          8        FETCH_OBJ_FUNC_ARG                               $6      'data'
          9        SEND_FUNC_ARG                                            $6
         10        DO_FCALL                                      0          
         11        ASSIGN_OBJ                                               'iterator'
         12        OP_DATA                                                  $5
         13      > JMP                                                      ->31
   17    14    >   FETCH_OBJ_R                                      ~8      'data'
         15        TYPE_CHECK                                  256          ~8
         16      > JMPZ                                                     ~9, ->27
   18    17    >   NEW                                              $11     'ArrayObject'
         18        INIT_FCALL                                               'get_object_vars'
         19        FETCH_OBJ_R                                      ~12     'data'
         20        SEND_VAL                                                 ~12
         21        DO_ICALL                                         $13     
         22        SEND_VAR_NO_REF_EX                                       $13
         23        DO_FCALL                                      0          
         24        ASSIGN_OBJ                                               'iterator'
         25        OP_DATA                                                  $11
         26      > JMP                                                      ->31
   20    27    >   NEW                                              $15     'Exception'
         28        SEND_VAL_EX                                              '%24objOrArray+is+neither+an+array+or+an+object'
         29        DO_FCALL                                      0          
         30      > THROW                                         0          $15
   23    31    >   FETCH_OBJ_R                                      ~17     'iterator'
         32      > RETURN                                                   ~17
   24    33*     > RETURN                                                   null

End of function getiterator

End of class values.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.75 ms | 1400 KiB | 17 Q