3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private static $instance; public static function getInstance() { if (null === $this->instance) { static::$instance = new self; } return static::instance; } } $a = A::getInstance(); var_dump($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o3MlE
function name:  (null)
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_STATIC_METHOD_CALL                                  'A', 'getInstance'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   19     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

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

End of function getinstance

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.8 ms | 1395 KiB | 15 Q