3v4l.org

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

Class Foo:
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/6TZMC
function name:  getInstance
number of ops:  12
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ISSET_ISEMPTY_STATIC_PROP                        ~1      'instance'
          1        BOOL_NOT                                         ~2      ~1
          2      > JMPZ                                                     ~2, ->9
   11     3    >   ASSIGN                                                   !0, 'Foo'
   12     4        FETCH_CLASS                                   0  $5      !0
          5        NEW                                              $6      $5
          6        DO_FCALL                                      0          
          7        ASSIGN_STATIC_PROP                                       'instance'
          8        OP_DATA                                                  $6
   14     9    >   FETCH_STATIC_PROP_R          unknown             ~8      'instance'
         10      > RETURN                                                   ~8
   15    11*     > RETURN                                                   null

End of function getinstance

Function show:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6TZMC
function name:  show
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_CLASS_CONSTANT                             ~0      'CON'
          1        ECHO                                                     ~0
   19     2      > RETURN                                                   null

End of function show

End of class Foo.

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/6TZMC
function name:  getInstance
number of ops:  12
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   ISSET_ISEMPTY_STATIC_PROP                        ~1      'instance'
          1        BOOL_NOT                                         ~2      ~1
          2      > JMPZ                                                     ~2, ->9
   31     3    >   ASSIGN                                                   !0, 'FooChild'
   32     4        FETCH_CLASS                                   0  $5      !0
          5        NEW                                              $6      $5
          6        DO_FCALL                                      0          
          7        ASSIGN_STATIC_PROP                                       'instance'
          8        OP_DATA                                                  $6
   34     9    >   FETCH_STATIC_PROP_R          unknown             ~8      'instance'
         10      > RETURN                                                   ~8
   35    11*     > RETURN                                                   null

End of function getinstance

Function show:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6TZMC
function name:  show
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_CLASS_CONSTANT                             ~0      'CON'
          1        ECHO                                                     ~0
   19     2      > RETURN                                                   null

End of function show

End of class FooChild.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.97 ms | 1399 KiB | 13 Q