3v4l.org

run code in 500+ PHP versions simultaneously
<?php class LastNames1 { public static function foo(){ // do stuff } } class LastNames2 { private static $instance = null; private function __construct(){ // do stuff } public function foo(){ // do stuff } public static function getInstance(){ if ( !self::$instance ){ self::$instance = new LastNames2(); } return self::$instance; } } $LastNames2 = LastNames2::getInstance(); for ($i = 0; $i <= 100000; $i++) { // LastNames1::foo(); $LastNames2->foo(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
Branch analysis from position: 5
filename:       /in/Adcq6
function name:  (null)
number of ops:  11
compiled vars:  !0 = $LastNames2, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_STATIC_METHOD_CALL                                  'LastNames2', 'getInstance'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   33     3        ASSIGN                                                   !1, 0
          4      > JMP                                                      ->8
   35     5    >   INIT_METHOD_CALL                                         !0, 'foo'
          6        DO_FCALL                                      0          
   33     7        PRE_INC                                                  !1
          8    >   IS_SMALLER_OR_EQUAL                                      !1, 100000
          9      > JMPNZ                                                    ~7, ->5
   36    10    > > RETURN                                                   1

Class LastNames1:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Adcq6
function name:  foo
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E > > RETURN                                                   null

End of function foo

End of class LastNames1.

Class LastNames2:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Adcq6
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                   null

End of function __construct

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

End of function foo

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

End of function getinstance

End of class LastNames2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.78 ms | 2304 KiB | 13 Q