3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Julio { protected static $instance = false; public function __construct( $args = array() ) {} public function get_instance() { if ( ! self::$instance ) { $className = __CLASS__; self::$instance = new $className( $args ); } return self::$instance; } } $j = new Julio(); var_dump( $j );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qK2cU
function name:  (null)
number of ops:  7
compiled vars:  !0 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Julio'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Class Julio:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qK2cU
function name:  __construct
number of ops:  2
compiled vars:  !0 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV_INIT                                        !0      <array>
          1      > RETURN                                                   null

End of function __construct

Function get_instance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/qK2cU
function name:  get_instance
number of ops:  13
compiled vars:  !0 = $className, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_STATIC_PROP_R          unknown             ~2      'instance'
          1        BOOL_NOT                                         ~3      ~2
          2      > JMPZ                                                     ~3, ->10
   10     3    >   ASSIGN                                                   !0, 'Julio'
   11     4        FETCH_CLASS                                   0  $6      !0
          5        NEW                                              $7      $6
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
          8        ASSIGN_STATIC_PROP                                       'instance'
          9        OP_DATA                                                  $7
   14    10    >   FETCH_STATIC_PROP_R          unknown             ~9      'instance'
         11      > RETURN                                                   ~9
   15    12*     > RETURN                                                   null

End of function get_instance

End of class Julio.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.19 ms | 1400 KiB | 15 Q