3v4l.org

run code in 300+ PHP versions simultaneously
<?php $aShitLoadOfSpaces = ' '; $headerName = 'CONTENT-LENGTH'; $start = microtime(true); for ($i = 0; $i < 500000; $i++) { if (strtolower($headerName) === 'content-length') {} } $duration = microtime(true) - $start; echo "strtolower: $duration\n"; $start = microtime(true); for ($i = 0; $i < 500000; $i++) { if ((($aShitLoadOfSpaces & $headerName) | $headerName) === 'content-length') {} } $duration = microtime(true) - $start; echo "Bitwise 1: $duration\n"; $start = microtime(true); for ($i = 0; $i < 500000; $i++) { if (trim($aShitLoadOfSpaces | $headerName) === 'content-length') {} } $duration = microtime(true) - $start; echo "Bitwise 2: $duration\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 8
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 31
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 53
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 59
Branch analysis from position: 59
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 53
Branch analysis from position: 62
Branch analysis from position: 53
Branch analysis from position: 59
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 31
Branch analysis from position: 38
Branch analysis from position: 31
Branch analysis from position: 35
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 8
Branch analysis from position: 16
Branch analysis from position: 8
Branch analysis from position: 13
filename:       /in/VsYpH
function name:  (null)
number of ops:  72
compiled vars:  !0 = $aShitLoadOfSpaces, !1 = $headerName, !2 = $start, !3 = $i, !4 = $duration
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
    5     1        ASSIGN                                                   !1, 'CONTENT-LENGTH'
    7     2        INIT_FCALL                                               'microtime'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !2, $7
    8     6        ASSIGN                                                   !3, 0
          7      > JMP                                                      ->14
    9     8    >   INIT_FCALL                                               'strtolower'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $10     
         11        IS_IDENTICAL                                             $10, 'content-length'
         12      > JMPZ                                                     ~11, ->13
    8    13    >   PRE_INC                                                  !3
         14    >   IS_SMALLER                                               !3, 500000
         15      > JMPNZ                                                    ~13, ->8
   11    16    >   INIT_FCALL                                               'microtime'
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $14     
         19        SUB                                              ~15     $14, !2
         20        ASSIGN                                                   !4, ~15
   12    21        ROPE_INIT                                     3  ~18     'strtolower%3A+'
         22        ROPE_ADD                                      1  ~18     ~18, !4
         23        ROPE_END                                      2  ~17     ~18, '%0A'
         24        ECHO                                                     ~17
   14    25        INIT_FCALL                                               'microtime'
         26        SEND_VAL                                                 <true>
         27        DO_ICALL                                         $20     
         28        ASSIGN                                                   !2, $20
   15    29        ASSIGN                                                   !3, 0
         30      > JMP                                                      ->36
   16    31    >   BW_AND                                           ~23     !0, !1
         32        BW_OR                                            ~24     !1, ~23
         33        IS_IDENTICAL                                             ~24, 'content-length'
         34      > JMPZ                                                     ~25, ->35
   15    35    >   PRE_INC                                                  !3
         36    >   IS_SMALLER                                               !3, 500000
         37      > JMPNZ                                                    ~27, ->31
   18    38    >   INIT_FCALL                                               'microtime'
         39        SEND_VAL                                                 <true>
         40        DO_ICALL                                         $28     
         41        SUB                                              ~29     $28, !2
         42        ASSIGN                                                   !4, ~29
   19    43        ROPE_INIT                                     3  ~32     'Bitwise+1%3A+'
         44        ROPE_ADD                                      1  ~32     ~32, !4
         45        ROPE_END                                      2  ~31     ~32, '%0A'
         46        ECHO                                                     ~31
   21    47        INIT_FCALL                                               'microtime'
         48        SEND_VAL                                                 <true>
         49        DO_ICALL                                         $34     
         50        ASSIGN                                                   !2, $34
   22    51        ASSIGN                                                   !3, 0
         52      > JMP                                                      ->60
   23    53    >   INIT_FCALL                                               'trim'
         54        BW_OR                                            ~37     !0, !1
         55        SEND_VAL                                                 ~37
         56        DO_ICALL                                         $38     
         57        IS_IDENTICAL                                             $38, 'content-length'
         58      > JMPZ                                                     ~39, ->59
   22    59    >   PRE_INC                                                  !3
         60    >   IS_SMALLER                                               !3, 500000
         61      > JMPNZ                                                    ~41, ->53
   25    62    >   INIT_FCALL                                               'microtime'
         63        SEND_VAL                                                 <true>
         64        DO_ICALL                                         $42     
         65        SUB                                              ~43     $42, !2
         66        ASSIGN                                                   !4, ~43
   26    67        ROPE_INIT                                     3  ~46     'Bitwise+2%3A+'
         68        ROPE_ADD                                      1  ~46     ~46, !4
         69        ROPE_END                                      2  ~45     ~46, '%0A'
         70        ECHO                                                     ~45
         71      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.55 ms | 1392 KiB | 19 Q