3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); function test() {} $nIter = 1000000; $argNums = [0, 1, 2, 3, 4, 5, 100]; $func = 'test'; foreach ($argNums as $argNum) { $args = $argNum == 0 ? [] : array_fill(0, $argNum, null); $startTime = microtime(true); for ($i = 0; $i < $nIter; ++$i) { call_user_func_array($func, $args); } $endTime = microtime(true); echo "cufa with $argNum args took ", $endTime - $startTime, "\n"; $startTime = microtime(true); for ($i = 0; $i < $nIter; ++$i) { switch (count($args)) { case 0: $func(); break; case 1: $func($args[0]); break; case 2: $func($args[0], $args[1]); break; case 3: $func($args[0], $args[1], $args[2]); break; case 4: $func($args[0], $args[1], $args[2], $args[3]); break; case 5: $func($args[0], $args[1], $args[2], $args[3], $args[4]); break; default: call_user_func_array($func, $args); break; } } $endTime = microtime(true); echo "switch with $argNum args took ", $endTime - $startTime, "\n"; $startTime = microtime(true); for ($i = 0; $i < $nIter; ++$i) { $func(...$args); } $endTime = microtime(true); echo "unpack with $argNum args took ", $endTime - $startTime, "\n"; }

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 172
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 172
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 25
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 134
Branch analysis from position: 134
2 jumps found. (Code = 44) Position 1 = 136, Position 2 = 49
Branch analysis from position: 136
1 jumps found. (Code = 42) Position 1 = 158
Branch analysis from position: 158
2 jumps found. (Code = 44) Position 1 = 160, Position 2 = 153
Branch analysis from position: 160
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 153
2 jumps found. (Code = 44) Position 1 = 160, Position 2 = 153
Branch analysis from position: 160
Branch analysis from position: 153
Branch analysis from position: 49
8 jumps found. (Code = 187) Position 1 = 64, Position 2 = 67, Position 3 = 73, Position 4 = 82, Position 5 = 94, Position 6 = 109, Position 7 = 127, Position 8 = 51
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 132
Branch analysis from position: 132
2 jumps found. (Code = 44) Position 1 = 136, Position 2 = 49
Branch analysis from position: 136
Branch analysis from position: 49
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 132
Branch analysis from position: 132
Branch analysis from position: 73
1 jumps found. (Code = 42) Position 1 = 132
Branch analysis from position: 132
Branch analysis from position: 82
1 jumps found. (Code = 42) Position 1 = 132
Branch analysis from position: 132
Branch analysis from position: 94
1 jumps found. (Code = 42) Position 1 = 132
Branch analysis from position: 132
Branch analysis from position: 109
1 jumps found. (Code = 42) Position 1 = 132
Branch analysis from position: 132
Branch analysis from position: 127
1 jumps found. (Code = 42) Position 1 = 132
Branch analysis from position: 132
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 64
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 67
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 73
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 82
Branch analysis from position: 59
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 94
Branch analysis from position: 61
2 jumps found. (Code = 44) Position 1 = 63, Position 2 = 109
Branch analysis from position: 63
1 jumps found. (Code = 42) Position 1 = 127
Branch analysis from position: 127
Branch analysis from position: 109
Branch analysis from position: 94
Branch analysis from position: 82
Branch analysis from position: 73
Branch analysis from position: 67
Branch analysis from position: 64
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 25
Branch analysis from position: 32
Branch analysis from position: 25
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 172
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 172
filename:       /in/boXdQ
function name:  (null)
number of ops:  174
compiled vars:  !0 = $nIter, !1 = $argNums, !2 = $func, !3 = $argNum, !4 = $args, !5 = $startTime, !6 = $i, !7 = $endTime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
    5     3        ASSIGN                                                   !0, 1000000
    6     4        ASSIGN                                                   !1, <array>
    8     5        ASSIGN                                                   !2, 'test'
   10     6      > FE_RESET_R                                       $12     !1, ->172
          7    > > FE_FETCH_R                                               $12, !3, ->172
   11     8    >   IS_EQUAL                                                 !3, 0
          9      > JMPZ                                                     ~13, ->12
         10    >   QM_ASSIGN                                        ~14     <array>
         11      > JMP                                                      ->18
         12    >   INIT_FCALL                                               'array_fill'
         13        SEND_VAL                                                 0
         14        SEND_VAR                                                 !3
         15        SEND_VAL                                                 null
         16        DO_ICALL                                         $15     
         17        QM_ASSIGN                                        ~14     $15
         18    >   ASSIGN                                                   !4, ~14
   13    19        INIT_FCALL                                               'microtime'
         20        SEND_VAL                                                 <true>
         21        DO_ICALL                                         $17     
         22        ASSIGN                                                   !5, $17
   14    23        ASSIGN                                                   !6, 0
         24      > JMP                                                      ->30
   15    25    >   INIT_USER_CALL                                0          'call_user_func_array', !2
         26        SEND_ARRAY                                               !4
         27        CHECK_UNDEF_ARGS                                         
         28        DO_FCALL                                      0          
   14    29        PRE_INC                                                  !6
         30    >   IS_SMALLER                                               !6, !0
         31      > JMPNZ                                                    ~22, ->25
   17    32    >   INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $23     
         35        ASSIGN                                                   !7, $23
   18    36        ROPE_INIT                                     3  ~26     'cufa+++with+'
         37        ROPE_ADD                                      1  ~26     ~26, !3
         38        ROPE_END                                      2  ~25     ~26, '+args+took+'
         39        ECHO                                                     ~25
         40        SUB                                              ~28     !7, !5
         41        ECHO                                                     ~28
         42        ECHO                                                     '%0A'
   20    43        INIT_FCALL                                               'microtime'
         44        SEND_VAL                                                 <true>
         45        DO_ICALL                                         $29     
         46        ASSIGN                                                   !5, $29
   21    47        ASSIGN                                                   !6, 0
         48      > JMP                                                      ->134
   22    49    >   COUNT                                            ~32     !4
         50      > SWITCH_LONG                                              ~32, [ 0:->64, 1:->67, 2:->73, 3:->82, 4:->94, 5:->109, ], ->127
   23    51    >   CASE                                                     ~32, 0
         52      > JMPNZ                                                    ~33, ->64
   24    53    >   CASE                                                     ~32, 1
         54      > JMPNZ                                                    ~33, ->67
   25    55    >   CASE                                                     ~32, 2
         56      > JMPNZ                                                    ~33, ->73
   26    57    >   CASE                                                     ~32, 3
         58      > JMPNZ                                                    ~33, ->82
   27    59    >   CASE                                                     ~32, 4
         60      > JMPNZ                                                    ~33, ->94
   28    61    >   CASE                                                     ~32, 5
         62      > JMPNZ                                                    ~33, ->109
         63    > > JMP                                                      ->127
   23    64    >   INIT_DYNAMIC_CALL                                        !2
         65        DO_FCALL                                      0          
         66      > JMP                                                      ->132
   24    67    >   INIT_DYNAMIC_CALL                                        !2
         68        CHECK_FUNC_ARG                                           
         69        FETCH_DIM_FUNC_ARG                               $35     !4, 0
         70        SEND_FUNC_ARG                                            $35
         71        DO_FCALL                                      0          
         72      > JMP                                                      ->132
   25    73    >   INIT_DYNAMIC_CALL                                        !2
         74        CHECK_FUNC_ARG                                           
         75        FETCH_DIM_FUNC_ARG                               $37     !4, 0
         76        SEND_FUNC_ARG                                            $37
         77        CHECK_FUNC_ARG                                           
         78        FETCH_DIM_FUNC_ARG                               $38     !4, 1
         79        SEND_FUNC_ARG                                            $38
         80        DO_FCALL                                      0          
         81      > JMP                                                      ->132
   26    82    >   INIT_DYNAMIC_CALL                                        !2
         83        CHECK_FUNC_ARG                                           
         84        FETCH_DIM_FUNC_ARG                               $40     !4, 0
         85        SEND_FUNC_ARG                                            $40
         86        CHECK_FUNC_ARG                                           
         87        FETCH_DIM_FUNC_ARG                               $41     !4, 1
         88        SEND_FUNC_ARG                                            $41
         89        CHECK_FUNC_ARG                                           
         90        FETCH_DIM_FUNC_ARG                               $42     !4, 2
         91        SEND_FUNC_ARG                                            $42
         92        DO_FCALL                                      0          
         93      > JMP                                                      ->132
   27    94    >   INIT_DYNAMIC_CALL                                        !2
         95        CHECK_FUNC_ARG                                           
         96        FETCH_DIM_FUNC_ARG                               $44     !4, 0
         97        SEND_FUNC_ARG                                            $44
         98        CHECK_FUNC_ARG                                           
         99        FETCH_DIM_FUNC_ARG                               $45     !4, 1
        100        SEND_FUNC_ARG                                            $45
        101        CHECK_FUNC_ARG                                           
        102        FETCH_DIM_FUNC_ARG                               $46     !4, 2
        103        SEND_FUNC_ARG                                            $46
        104        CHECK_FUNC_ARG                                           
        105        FETCH_DIM_FUNC_ARG                               $47     !4, 3
        106        SEND_FUNC_ARG                                            $47
        107        DO_FCALL                                      0          
        108      > JMP                                                      ->132
   28   109    >   INIT_DYNAMIC_CALL                                        !2
        110        CHECK_FUNC_ARG                                           
        111        FETCH_DIM_FUNC_ARG                               $49     !4, 0
        112        SEND_FUNC_ARG                                            $49
        113        CHECK_FUNC_ARG                                           
        114        FETCH_DIM_FUNC_ARG                               $50     !4, 1
        115        SEND_FUNC_ARG                                            $50
        116        CHECK_FUNC_ARG                                           
        117        FETCH_DIM_FUNC_ARG                               $51     !4, 2
        118        SEND_FUNC_ARG                                            $51
        119        CHECK_FUNC_ARG                                           
        120        FETCH_DIM_FUNC_ARG                               $52     !4, 3
        121        SEND_FUNC_ARG                                            $52
        122        CHECK_FUNC_ARG                                           
        123        FETCH_DIM_FUNC_ARG                               $53     !4, 4
        124        SEND_FUNC_ARG                                            $53
        125        DO_FCALL                                      0          
        126      > JMP                                                      ->132
   29   127    >   INIT_USER_CALL                                0          'call_user_func_array', !2
        128        SEND_ARRAY                                               !4
        129        CHECK_UNDEF_ARGS                                         
        130        DO_FCALL                                      0          
        131      > JMP                                                      ->132
        132    >   FREE                                                     ~32
   21   133        PRE_INC                                                  !6
        134    >   IS_SMALLER                                               !6, !0
        135      > JMPNZ                                                    ~57, ->49
   32   136    >   INIT_FCALL                                               'microtime'
        137        SEND_VAL                                                 <true>
        138        DO_ICALL                                         $58     
        139        ASSIGN                                                   !7, $58
   33   140        ROPE_INIT                                     3  ~61     'switch+with+'
        141        ROPE_ADD                                      1  ~61     ~61, !3
        142        ROPE_END                                      2  ~60     ~61, '+args+took+'
        143        ECHO                                                     ~60
        144        SUB                                              ~63     !7, !5
        145        ECHO                                                     ~63
        146        ECHO                                                     '%0A'
   35   147        INIT_FCALL                                               'microtime'
        148        SEND_VAL                                                 <true>
        149        DO_ICALL                                         $64     
        150        ASSIGN                                                   !5, $64
   36   151        ASSIGN                                                   !6, 0
        152      > JMP                                                      ->158
   37   153    >   INIT_DYNAMIC_CALL                                        !2
        154        SEND_UNPACK                                              !4
        155        CHECK_UNDEF_ARGS                                         
        156        DO_FCALL                                      1          
   36   157        PRE_INC                                                  !6
        158    >   IS_SMALLER                                               !6, !0
        159      > JMPNZ                                                    ~69, ->153
   39   160    >   INIT_FCALL                                               'microtime'
        161        SEND_VAL                                                 <true>
        162        DO_ICALL                                         $70     
        163        ASSIGN                                                   !7, $70
   40   164        ROPE_INIT                                     3  ~73     'unpack+with+'
        165        ROPE_ADD                                      1  ~73     ~73, !3
        166        ROPE_END                                      2  ~72     ~73, '+args+took+'
        167        ECHO                                                     ~72
        168        SUB                                              ~75     !7, !5
        169        ECHO                                                     ~75
        170        ECHO                                                     '%0A'
   10   171      > JMP                                                      ->7
        172    >   FE_FREE                                                  $12
   41   173      > RETURN                                                   1

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

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.35 ms | 1412 KiB | 19 Q