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

End of function getiterator

End of class values.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.2 ms | 945 KiB | 18 Q