3v4l.org

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

Function f0:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dW3ar
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/dW3ar
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/dW3ar
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:
155.76 ms | 1411 KiB | 22 Q