3v4l.org

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

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/dADQb
function name:  __construct
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   ISSET_ISEMPTY_STATIC_PROP                            ~0      'singleton'
          1        BOOL_NOT                                             ~1      ~0
          2      > JMPZ                                                         ~1, ->6
    8     3    >   FETCH_THIS                                           ~3      
          4        ASSIGN_STATIC_PROP                                           'singleton'
          5        OP_DATA                                                      ~3
   10     6    >   FETCH_STATIC_PROP_R              unknown             ~4      'singleton'
          7      > RETURN                                                       ~4
   11     8*     > RETURN                                                       null

End of function __construct

End of class A.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.21 ms | 1866 KiB | 14 Q