3v4l.org

run code in 300+ PHP versions simultaneously
<?php class base {} ; class foo extends base { protected $a; public function __construct(){ $a = get_called_class(); } } class bar extends base { protected $a; public function __construct(){ $a = get_class($this); } } $time = microtime(true); for($x=0;$x<10000;$x++){ $foo = new foo(); } echo round(microtime(true) - $time, 5)." s\n"; $time = microtime(true); for($x=0;$x<10000;$x++){ $foo = new bar(); } echo round(microtime(true) - $time, 5)." s\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 6
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 28
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 28
Branch analysis from position: 34
Branch analysis from position: 28
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 6
Branch analysis from position: 12
Branch analysis from position: 6
filename:       /in/W8Gbp
function name:  (null)
number of ops:  45
compiled vars:  !0 = $time, !1 = $x, !2 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $3      
          3        ASSIGN                                                   !0, $3
   25     4        ASSIGN                                                   !1, 0
          5      > JMP                                                      ->10
   26     6    >   NEW                                              $6      'foo'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $6
   25     9        PRE_INC                                                  !1
         10    >   IS_SMALLER                                               !1, 10000
         11      > JMPNZ                                                    ~10, ->6
   28    12    >   INIT_FCALL                                               'round'
         13        INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $11     
         16        SUB                                              ~12     $11, !0
         17        SEND_VAL                                                 ~12
         18        SEND_VAL                                                 5
         19        DO_ICALL                                         $13     
         20        CONCAT                                           ~14     $13, '+s%0A'
         21        ECHO                                                     ~14
   30    22        INIT_FCALL                                               'microtime'
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $15     
         25        ASSIGN                                                   !0, $15
   31    26        ASSIGN                                                   !1, 0
         27      > JMP                                                      ->32
   32    28    >   NEW                                              $18     'bar'
         29        DO_FCALL                                      0          
         30        ASSIGN                                                   !2, $18
   31    31        PRE_INC                                                  !1
         32    >   IS_SMALLER                                               !1, 10000
         33      > JMPNZ                                                    ~22, ->28
   34    34    >   INIT_FCALL                                               'round'
         35        INIT_FCALL                                               'microtime'
         36        SEND_VAL                                                 <true>
         37        DO_ICALL                                         $23     
         38        SUB                                              ~24     $23, !0
         39        SEND_VAL                                                 ~24
         40        SEND_VAL                                                 5
         41        DO_ICALL                                         $25     
         42        CONCAT                                           ~26     $25, '+s%0A'
         43        ECHO                                                     ~26
         44      > RETURN                                                   1

Class base: [no user functions]
Class foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W8Gbp
function name:  __construct
number of ops:  3
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   GET_CALLED_CLASS                                 ~1      
          1        ASSIGN                                                   !0, ~1
   10     2      > RETURN                                                   null

End of function __construct

End of class foo.

Class bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W8Gbp
function name:  __construct
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_THIS                                       ~1      
          1        GET_CLASS                                        ~2      ~1
          2        ASSIGN                                                   !0, ~2
   20     3      > RETURN                                                   null

End of function __construct

End of class bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.67 ms | 1400 KiB | 17 Q