3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test{ protected static $_instance = NULL; public static function getInstance() { if( ! self::$_instance instanceof self) { return self::$_instance = new self; } return self::$_instance; } } test::getInstance(); test::getInstance();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Lr7RZ
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_STATIC_METHOD_CALL                                  'test', 'getInstance'
          1        DO_FCALL                                      0          
   12     2        INIT_STATIC_METHOD_CALL                                  'test', 'getInstance'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Class test:
Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Lr7RZ
function name:  getInstance
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      '_instance'
          1        INSTANCEOF                                       ~1      ~0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->9
    6     4    >   NEW                          self                $4      
          5        DO_FCALL                                      0          
          6        ASSIGN_STATIC_PROP                               ~3      '_instance'
          7        OP_DATA                                                  $4
          8      > RETURN                                                   ~3
    8     9    >   FETCH_STATIC_PROP_R          unknown             ~6      '_instance'
         10      > RETURN                                                   ~6
    9    11*     > RETURN                                                   null

End of function getinstance

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.44 ms | 1394 KiB | 13 Q