3v4l.org

run code in 300+ PHP versions simultaneously
<?php class values implements IteratorAggregate { protected $iterator; public function __construct($objOrArr) { if(is_array($objOrArr)) { $this->iterator = new ArrayObject($objOrArr); } else if(is_object($objOrArr)) { $this->iterator = new ArrayObject(get_object_vars($objOrArr)); } else { throw new Exception('$objOrArray is neither an array or an object'); } } public function getIterator() { 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/r8clv
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'
   23     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
   25     7        ASSIGN                                                   !1, 0
          8      > JMP                                                      ->19
   26     9    > > FE_RESET_R                                       $10     !0, ->17
         10    > > FE_FETCH_R                                       ~11     $10, !2, ->17
         11    >   ASSIGN                                                   !3, ~11
   27    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !3
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
   26    16      > JMP                                                      ->10
         17    >   FE_FREE                                                  $10
   25    18        PRE_INC                                                  !1
         19    >   IS_SMALLER                                               !1, 100
         20      > JMPNZ                                                    ~15, ->9
   29    21    > > RETURN                                                   1

Class values:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 20
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 20
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/r8clv
function name:  __construct
number of ops:  25
compiled vars:  !0 = $objOrArr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        TYPE_CHECK                                  128          !0
          2      > JMPZ                                                     ~1, ->9
   10     3    >   NEW                                              $3      'ArrayObject'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN_OBJ                                               'iterator'
          7        OP_DATA                                                  $3
          8      > JMP                                                      ->24
   11     9    >   TYPE_CHECK                                  256          !0
         10      > JMPZ                                                     ~5, ->20
   12    11    >   NEW                                              $7      'ArrayObject'
         12        INIT_FCALL                                               'get_object_vars'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $8      
         15        SEND_VAR_NO_REF_EX                                       $8
         16        DO_FCALL                                      0          
         17        ASSIGN_OBJ                                               'iterator'
         18        OP_DATA                                                  $7
         19      > JMP                                                      ->24
   14    20    >   NEW                                              $10     'Exception'
         21        SEND_VAL_EX                                              '%24objOrArray+is+neither+an+array+or+an+object'
         22        DO_FCALL                                      0          
         23      > THROW                                         0          $10
   16    24    > > RETURN                                                   null

End of function __construct

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

End of function getiterator

End of class values.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.51 ms | 1392 KiB | 17 Q