3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo{ const CON = 'CON_FOO'; } class FooChild extends Foo{ const CON = 'CON_FOOCHILD'; static private $instance; public static function getInstance() { if (!isset(self::$instance)) { $c = __CLASS__; self::$instance = new $c; } return self::$instance; } } $inst = FooChild::getInstance(); echo $inst::CON;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TWUpd
function name:  (null)
number of ops:  7
compiled vars:  !0 = $inst
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_STATIC_METHOD_CALL                                  'FooChild', 'getInstance'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   24     3        FETCH_CLASS                                   0  $3      !0
          4        FETCH_CLASS_CONSTANT                             ~4      $3, 'CON'
          5        ECHO                                                     ~4
          6      > RETURN                                                   1

Class Foo: [no user functions]
Class FooChild:
Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/TWUpd
function name:  getInstance
number of ops:  12
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ISSET_ISEMPTY_STATIC_PROP                        ~1      'instance'
          1        BOOL_NOT                                         ~2      ~1
          2      > JMPZ                                                     ~2, ->9
   16     3    >   ASSIGN                                                   !0, 'FooChild'
   17     4        FETCH_CLASS                                   0  $5      !0
          5        NEW                                              $6      $5
          6        DO_FCALL                                      0          
          7        ASSIGN_STATIC_PROP                                       'instance'
          8        OP_DATA                                                  $6
   19     9    >   FETCH_STATIC_PROP_R          unknown             ~8      'instance'
         10      > RETURN                                                   ~8
   20    11*     > RETURN                                                   null

End of function getinstance

End of class FooChild.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.57 ms | 1394 KiB | 13 Q