3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public $id; public function __construct(){ static $counter = 0; $this->id = $counter; ++$counter; } } $collection = [new Foo(), new Foo(), new Foo(), new Foo()]; print_r(array_column($collection, 'id'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8Tf8a
function name:  (null)
number of ops:  21
compiled vars:  !0 = $collection
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   NEW                                                  $1      'Foo'
          1        DO_FCALL                                          0          
          2        INIT_ARRAY                                           ~3      $1
          3        NEW                                                  $4      'Foo'
          4        DO_FCALL                                          0          
          5        ADD_ARRAY_ELEMENT                                    ~3      $4
          6        NEW                                                  $6      'Foo'
          7        DO_FCALL                                          0          
          8        ADD_ARRAY_ELEMENT                                    ~3      $6
          9        NEW                                                  $8      'Foo'
         10        DO_FCALL                                          0          
         11        ADD_ARRAY_ELEMENT                                    ~3      $8
         12        ASSIGN                                                       !0, ~3
   16    13        INIT_FCALL                                                   'print_r'
         14        INIT_FCALL                                                   'array_column'
         15        SEND_VAR                                                     !0
         16        SEND_VAL                                                     'id'
         17        DO_ICALL                                             $11     
         18        SEND_VAR                                                     $11
         19        DO_ICALL                                                     
         20      > RETURN                                                       1

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

End of function __construct

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.25 ms | 3303 KiB | 15 Q