3v4l.org

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

Function f0:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nEknS
function name:  f0
number of ops:  2
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     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/nEknS
function name:  f1
number of ops:  2
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     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/nEknS
function name:  f2
number of ops:  2
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     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:
141.25 ms | 1410 KiB | 22 Q