3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Sample{ private static $objects=array(); public function __construct() { static::$objects[]=$this; } public function getObjects(){ return static::$objects; } } new Sample(); new Sample(); new Sample(); $a=new Sample(); var_dump($a->getObjects());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SrEPg
function name:  (null)
number of ops:  18
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'Sample'
          1        DO_FCALL                                      0          
          2        FREE                                                     $1
   17     3        NEW                                              $3      'Sample'
          4        DO_FCALL                                      0          
          5        FREE                                                     $3
   18     6        NEW                                              $5      'Sample'
          7        DO_FCALL                                      0          
          8        FREE                                                     $5
   20     9        NEW                                              $7      'Sample'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !0, $7
   22    12        INIT_FCALL                                               'var_dump'
         13        INIT_METHOD_CALL                                         !0, 'getObjects'
         14        DO_FCALL                                      0  $10     
         15        SEND_VAR                                                 $10
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Class Sample:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SrEPg
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_THIS                                       ~2      
          1        FETCH_STATIC_PROP_W          global              $0      'objects'
          2        ASSIGN_DIM                                               $0
          3        OP_DATA                                                  ~2
    8     4      > RETURN                                                   null

End of function __construct

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

End of function getobjects

End of class Sample.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.01 ms | 1388 KiB | 15 Q