3v4l.org

run code in 300+ PHP versions simultaneously
<?php $avg = 2; $calls = 100000; class Foo {} function f0($foo) {} function f1(Foo $foo) {} function f2(Foo $foo = null) {} $foo = new Foo(); $m = array(); for ($j = 0; $j < $avg; $j++) { $start = microtime(true); for ($i = 0; $i < $calls; $i++) { f0($foo); } $m[] = microtime(true) - $start; } var_dump(array_sum($m) / $avg); $m = array(); for ($j = 0; $j < $avg; $j++) { $start = microtime(true); for ($i = 0; $i < $calls; $i++) { f1($foo); } $m[] = microtime(true) - $start; } var_dump(array_sum($m) / $avg); $m = array(); for ($j = 0; $j < $avg; $j++) { $start = microtime(true); for ($i = 0; $i < $calls; $i++) { f2($foo); } $m[] = microtime(true) - $start; } var_dump(array_sum($m) / $avg);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 8
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 39
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 89
Branch analysis from position: 89
2 jumps found. (Code = 44) Position 1 = 91, Position 2 = 70
Branch analysis from position: 91
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 70
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
2 jumps found. (Code = 44) Position 1 = 82, Position 2 = 76
Branch analysis from position: 82
2 jumps found. (Code = 44) Position 1 = 91, Position 2 = 70
Branch analysis from position: 91
Branch analysis from position: 70
Branch analysis from position: 76
2 jumps found. (Code = 44) Position 1 = 82, Position 2 = 76
Branch analysis from position: 82
Branch analysis from position: 76
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 45
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 39
Branch analysis from position: 60
Branch analysis from position: 39
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 45
Branch analysis from position: 51
Branch analysis from position: 45
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 14
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 8
Branch analysis from position: 29
Branch analysis from position: 8
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 14
Branch analysis from position: 20
Branch analysis from position: 14
filename:       /in/os5Gg
function name:  (null)
number of ops:  99
compiled vars:  !0 = $avg, !1 = $calls, !2 = $foo, !3 = $m, !4 = $j, !5 = $start, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 2
    4     1        ASSIGN                                                   !1, 100000
   11     2        NEW                                              $9      'Foo'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !2, $9
   13     5        ASSIGN                                                   !3, <array>
   14     6        ASSIGN                                                   !4, 0
          7      > JMP                                                      ->27
   15     8    >   INIT_FCALL                                               'microtime'
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $14     
         11        ASSIGN                                                   !5, $14
   16    12        ASSIGN                                                   !6, 0
         13      > JMP                                                      ->18
   17    14    >   INIT_FCALL                                               'f0'
         15        SEND_VAR                                                 !2
         16        DO_FCALL                                      0          
   16    17        PRE_INC                                                  !6
         18    >   IS_SMALLER                                               !6, !1
         19      > JMPNZ                                                    ~19, ->14
   19    20    >   INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $21     
         23        SUB                                              ~22     $21, !5
         24        ASSIGN_DIM                                               !3
         25        OP_DATA                                                  ~22
   14    26        PRE_INC                                                  !4
         27    >   IS_SMALLER                                               !4, !0
         28      > JMPNZ                                                    ~24, ->8
   21    29    >   INIT_FCALL                                               'var_dump'
         30        INIT_FCALL                                               'array_sum'
         31        SEND_VAR                                                 !3
         32        DO_ICALL                                         $25     
         33        DIV                                              ~26     $25, !0
         34        SEND_VAL                                                 ~26
         35        DO_ICALL                                                 
   23    36        ASSIGN                                                   !3, <array>
   24    37        ASSIGN                                                   !4, 0
         38      > JMP                                                      ->58
   25    39    >   INIT_FCALL                                               'microtime'
         40        SEND_VAL                                                 <true>
         41        DO_ICALL                                         $30     
         42        ASSIGN                                                   !5, $30
   26    43        ASSIGN                                                   !6, 0
         44      > JMP                                                      ->49
   27    45    >   INIT_FCALL                                               'f1'
         46        SEND_VAR                                                 !2
         47        DO_FCALL                                      0          
   26    48        PRE_INC                                                  !6
         49    >   IS_SMALLER                                               !6, !1
         50      > JMPNZ                                                    ~35, ->45
   29    51    >   INIT_FCALL                                               'microtime'
         52        SEND_VAL                                                 <true>
         53        DO_ICALL                                         $37     
         54        SUB                                              ~38     $37, !5
         55        ASSIGN_DIM                                               !3
         56        OP_DATA                                                  ~38
   24    57        PRE_INC                                                  !4
         58    >   IS_SMALLER                                               !4, !0
         59      > JMPNZ                                                    ~40, ->39
   31    60    >   INIT_FCALL                                               'var_dump'
         61        INIT_FCALL                                               'array_sum'
         62        SEND_VAR                                                 !3
         63        DO_ICALL                                         $41     
         64        DIV                                              ~42     $41, !0
         65        SEND_VAL                                                 ~42
         66        DO_ICALL                                                 
   33    67        ASSIGN                                                   !3, <array>
   34    68        ASSIGN                                                   !4, 0
         69      > JMP                                                      ->89
   35    70    >   INIT_FCALL                                               'microtime'
         71        SEND_VAL                                                 <true>
         72        DO_ICALL                                         $46     
         73        ASSIGN                                                   !5, $46
   36    74        ASSIGN                                                   !6, 0
         75      > JMP                                                      ->80
   37    76    >   INIT_FCALL                                               'f2'
         77        SEND_VAR                                                 !2
         78        DO_FCALL                                      0          
   36    79        PRE_INC                                                  !6
         80    >   IS_SMALLER                                               !6, !1
         81      > JMPNZ                                                    ~51, ->76
   39    82    >   INIT_FCALL                                               'microtime'
         83        SEND_VAL                                                 <true>
         84        DO_ICALL                                         $53     
         85        SUB                                              ~54     $53, !5
         86        ASSIGN_DIM                                               !3
         87        OP_DATA                                                  ~54
   34    88        PRE_INC                                                  !4
         89    >   IS_SMALLER                                               !4, !0
         90      > JMPNZ                                                    ~56, ->70
   41    91    >   INIT_FCALL                                               'var_dump'
         92        INIT_FCALL                                               'array_sum'
         93        SEND_VAR                                                 !3
         94        DO_ICALL                                         $57     
         95        DIV                                              ~58     $57, !0
         96        SEND_VAL                                                 ~58
         97        DO_ICALL                                                 
         98      > RETURN                                                   1

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

End of function f0

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

End of function f1

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

End of function f2

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.51 ms | 1407 KiB | 22 Q