3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MySingleton { private static MySingleton $instance; public static function getInstance () { return self::$instance ??= new MySingleton(); } private function __construct () { echo "Does it work?"; } } $instance = MySingleton::getInstance();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PuJJS
function name:  (null)
number of ops:  4
compiled vars:  !0 = $instance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_STATIC_METHOD_CALL                                  'MySingleton', 'getInstance'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
          3      > RETURN                                                   1

Class MySingleton:
Function getinstance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PuJJS
function name:  getInstance
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_STATIC_PROP_IS                             ~0      'instance'
          1        COALESCE                                         ~1      ~0
          2        NEW                                              $2      'MySingleton'
          3        DO_FCALL                                      0          
          4        ASSIGN_STATIC_PROP                               ~4      'instance'
          5        OP_DATA                                                  $2
          6        QM_ASSIGN                                        ~1      ~4
          7      > RETURN                                                   ~1
    8     8*     > RETURN                                                   null

End of function getinstance

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PuJJS
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ECHO                                                     'Does+it+work%3F'
   12     1      > RETURN                                                   null

End of function __construct

End of class MySingleton.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.02 ms | 1393 KiB | 13 Q