3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Cars implements Iterator { private $pointer = 0; private $array = array(); public function __construct() { $this->pointer = 0; } public function addCar($car) { array_push($this->array, $car); } function rewind() { $this->pointer = 0; } function current() { return $this->array[$this->pointer]; } function key() { return $this->pointer; } function next() { ++$this->pointer; } public function valid() { return isset($this->array[$this->pointer]); } } $car = new Cars; $car->addCar("Volvo"); $car->addCar("BMW"); $car->addCar("Mercedes"); foreach ($car as $key => $value) { echo $key . ": " . $value . "<br />"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 21
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/UPZOs
function name:  (null)
number of ops:  23
compiled vars:  !0 = $car, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'cars'
   28     1        NEW                                              $3      'Cars'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   29     4        INIT_METHOD_CALL                                         !0, 'addCar'
          5        SEND_VAL_EX                                              'Volvo'
          6        DO_FCALL                                      0          
   30     7        INIT_METHOD_CALL                                         !0, 'addCar'
          8        SEND_VAL_EX                                              'BMW'
          9        DO_FCALL                                      0          
   31    10        INIT_METHOD_CALL                                         !0, 'addCar'
         11        SEND_VAL_EX                                              'Mercedes'
         12        DO_FCALL                                      0          
   32    13      > FE_RESET_R                                       $9      !0, ->21
         14    > > FE_FETCH_R                                       ~10     $9, !1, ->21
         15    >   ASSIGN                                                   !2, ~10
   33    16        CONCAT                                           ~12     !2, '%3A+'
         17        CONCAT                                           ~13     ~12, !1
         18        CONCAT                                           ~14     ~13, '%3Cbr+%2F%3E'
         19        ECHO                                                     ~14
   32    20      > JMP                                                      ->14
         21    >   FE_FREE                                                  $9
   34    22      > RETURN                                                   1

Class Cars:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UPZOs
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN_OBJ                                               'pointer'
          1        OP_DATA                                                  0
    8     2      > RETURN                                                   null

End of function __construct

Function addcar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UPZOs
function name:  addCar
number of ops:  7
compiled vars:  !0 = $car
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'array_push'
          2        FETCH_OBJ_W                                      $1      'array'
          3        SEND_REF                                                 $1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   11     6      > RETURN                                                   null

End of function addcar

Function rewind:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UPZOs
function name:  rewind
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN_OBJ                                               'pointer'
          1        OP_DATA                                                  0
   14     2      > 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/UPZOs
function name:  current
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_OBJ_R                                      ~1      'pointer'
          1        FETCH_OBJ_R                                      ~0      'array'
          2        FETCH_DIM_R                                      ~2      ~0, ~1
          3      > RETURN                                                   ~2
   17     4*     > 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/UPZOs
function name:  key
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                      ~0      'pointer'
          1      > RETURN                                                   ~0
   20     2*     > 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/UPZOs
function name:  next
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   PRE_INC_OBJ                                              'pointer'
   23     1      > 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/UPZOs
function name:  valid
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   FETCH_OBJ_R                                      ~1      'pointer'
          1        FETCH_OBJ_IS                                     ~0      'array'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~0, ~1
          3      > RETURN                                                   ~2
   26     4*     > RETURN                                                   null

End of function valid

End of class Cars.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.81 ms | 1400 KiB | 15 Q