3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($label = '') { global $t; $t2 = microtime(1); if ($label) echo str_pad($label . ': ', 32, '.', STR_PAD_RIGHT) . ' ' . 1000 * ($t2 - $t) . 'ms' . "\n"; $t = $t2; } class Foo { public function fooLoop() { for ($i = 1000000; $i--;) $this->foo(); } public function barLoop() { for ($i = 1000000; $i--;) $this->bar(); } public function bazLoop() { for ($i = 1000000; $i--;) $this->baz(); } public function foo() { } protected function bar() { } private function baz() { } } $f = new Foo(); test(); $f->fooLoop(); test('pub'); $f->barLoop(); test('pro'); $f->bazLoop(); test('pri');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/42Vb8
function name:  (null)
number of ops:  21
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   35     3        INIT_FCALL                                               'test'
          4        DO_FCALL                                      0          
   36     5        INIT_METHOD_CALL                                         !0, 'fooLoop'
          6        DO_FCALL                                      0          
   37     7        INIT_FCALL                                               'test'
          8        SEND_VAL                                                 'pub'
          9        DO_FCALL                                      0          
   38    10        INIT_METHOD_CALL                                         !0, 'barLoop'
         11        DO_FCALL                                      0          
   39    12        INIT_FCALL                                               'test'
         13        SEND_VAL                                                 'pro'
         14        DO_FCALL                                      0          
   40    15        INIT_METHOD_CALL                                         !0, 'bazLoop'
         16        DO_FCALL                                      0          
   41    17        INIT_FCALL                                               'test'
         18        SEND_VAL                                                 'pri'
         19        DO_FCALL                                      0          
         20      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 21
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/42Vb8
function name:  test
number of ops:  23
compiled vars:  !0 = $label, !1 = $t, !2 = $t2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      ''
    3     1        BIND_GLOBAL                                              !1, 't'
    4     2        INIT_FCALL                                               'microtime'
          3        SEND_VAL                                                 1
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !2, $3
    5     6      > JMPZ                                                     !0, ->21
          7    >   INIT_FCALL                                               'str_pad'
          8        CONCAT                                           ~5      !0, '%3A+'
          9        SEND_VAL                                                 ~5
         10        SEND_VAL                                                 32
         11        SEND_VAL                                                 '.'
         12        SEND_VAL                                                 1
         13        DO_ICALL                                         $6      
         14        CONCAT                                           ~7      $6, '+'
         15        SUB                                              ~8      !2, !1
         16        MUL                                              ~9      ~8, 1000
         17        CONCAT                                           ~10     ~7, ~9
         18        CONCAT                                           ~11     ~10, 'ms'
         19        CONCAT                                           ~12     ~11, '%0A'
         20        ECHO                                                     ~12
    6    21    >   ASSIGN                                                   !1, !2
    7    22      > RETURN                                                   null

End of function test

Class Foo:
Function fooloop:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 2
Branch analysis from position: 6
Branch analysis from position: 2
filename:       /in/42Vb8
function name:  fooLoop
number of ops:  7
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, 1000000
          1      > JMP                                                      ->4
          2    >   INIT_METHOD_CALL                                         'foo'
          3        DO_FCALL                                      0          
          4    >   POST_DEC                                         ~3      !0
          5      > JMPNZ                                                    ~3, ->2
   12     6    > > RETURN                                                   null

End of function fooloop

Function barloop:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 2
Branch analysis from position: 6
Branch analysis from position: 2
filename:       /in/42Vb8
function name:  barLoop
number of ops:  7
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, 1000000
          1      > JMP                                                      ->4
          2    >   INIT_METHOD_CALL                                         'bar'
          3        DO_FCALL                                      0          
          4    >   POST_DEC                                         ~3      !0
          5      > JMPNZ                                                    ~3, ->2
   16     6    > > RETURN                                                   null

End of function barloop

Function bazloop:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 2
Branch analysis from position: 6
Branch analysis from position: 2
filename:       /in/42Vb8
function name:  bazLoop
number of ops:  7
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, 1000000
          1      > JMP                                                      ->4
          2    >   INIT_METHOD_CALL                                         'baz'
          3        DO_FCALL                                      0          
          4    >   POST_DEC                                         ~3      !0
          5      > JMPNZ                                                    ~3, ->2
   20     6    > > RETURN                                                   null

End of function bazloop

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

End of function foo

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

End of function bar

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

End of function baz

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.57 ms | 1407 KiB | 21 Q