3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Item { private $id; public function __construct(int $id) { $this->id = $id; } public function id() : int { return $this->id; } } class Collection extends ArrayIterator { public function current() : Item { return parent::current(); } } $items = []; for ($i=0; $i<10; $i++) { $items[] = new Item($i); } $collection = new Collection($items); foreach ($collection as $item) { printf("\tClass: %s. Calling id() method returns %d (%s)\n", get_class($item), $item->id(), gettype($item->id())); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 30
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 30
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
Branch analysis from position: 3
filename:       /in/VSf6k
function name:  (null)
number of ops:  32
compiled vars:  !0 = $items, !1 = $i, !2 = $collection, !3 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ASSIGN                                                   !0, <array>
   24     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->9
   25     3    >   NEW                                              $7      'Item'
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
          6        ASSIGN_DIM                                               !0
          7        OP_DATA                                                  $7
   24     8        PRE_INC                                                  !1
          9    >   IS_SMALLER                                               !1, 10
         10      > JMPNZ                                                    ~10, ->3
   28    11    >   NEW                                              $11     'Collection'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !2, $11
   30    15      > FE_RESET_R                                       $14     !2, ->30
         16    > > FE_FETCH_R                                               $14, !3, ->30
   31    17    >   INIT_FCALL                                               'printf'
         18        SEND_VAL                                                 '%09Class%3A+%25s.+Calling+id%28%29+method+returns+%25d+%28%25s%29%0A'
         19        GET_CLASS                                        ~15     !3
         20        SEND_VAL                                                 ~15
         21        INIT_METHOD_CALL                                         !3, 'id'
         22        DO_FCALL                                      0  $16     
         23        SEND_VAR                                                 $16
         24        INIT_METHOD_CALL                                         !3, 'id'
         25        DO_FCALL                                      0  $17     
         26        GET_TYPE                                         ~18     $17
         27        SEND_VAL                                                 ~18
         28        DO_ICALL                                                 
   30    29      > JMP                                                      ->16
         30    >   FE_FREE                                                  $14
   32    31      > RETURN                                                   1

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

End of function __construct

Function id:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VSf6k
function name:  id
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_OBJ_R                                      ~0      'id'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   12     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function id

End of class Item.

Class Collection:
Function current:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VSf6k
function name:  current
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_STATIC_METHOD_CALL                                  'current'
          1        DO_FCALL                                      0  $0      
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   20     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function current

End of class Collection.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.86 ms | 1405 KiB | 15 Q