3v4l.org

run code in 300+ PHP versions simultaneously
<?php for( $i = 0 ; $i < 100000 ; $i++ ) { $ARR[$i] = sprintf('%08X', $i); } // lower(STRSPN) on a string $start = microtime(true); for( $i = 0 ; $i < 100000 ; $i++ ) { strlen($ARR[$i]) != strspn(strtolower($ARR[$i]), '0123456789abcdef'); } $crc = microtime(true) - $start; printf("%-11s %0.2f\n", "STRSPN+l", $crc); unset($ARX); // STRSPN on a string $start = microtime(true); for( $i = 0 ; $i < 100000 ; $i++ ) { strlen($ARR[$i]) != strspn($ARR[$i], '0123456789ABCDEFabcdef'); } $crc = microtime(true) - $start; printf("%-11s %0.2f\n", "STRSPN", $crc); unset($ARX); // PREG_MATCH on a string $start = microtime(true); for( $i = 0 ; $i < 100000 ; $i++ ) { preg_match('#[^0-9a-f]#i', $ARR[$i], $_s); } $crc = microtime(true) - $start; printf("%-11s %0.2f\n", "PREG_MATCH", $crc); unset($ARX);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 17
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 49
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 85
Branch analysis from position: 85
2 jumps found. (Code = 44) Position 1 = 87, Position 2 = 78
Branch analysis from position: 87
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 78
2 jumps found. (Code = 44) Position 1 = 87, Position 2 = 78
Branch analysis from position: 87
Branch analysis from position: 78
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 49
Branch analysis from position: 61
Branch analysis from position: 49
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 17
Branch analysis from position: 32
Branch analysis from position: 17
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 2
Branch analysis from position: 11
Branch analysis from position: 2
filename:       /in/BDclC
function name:  (null)
number of ops:  99
compiled vars:  !0 = $i, !1 = $ARR, !2 = $start, !3 = $crc, !4 = $ARX, !5 = $_s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->9
    5     2    >   INIT_FCALL                                               'sprintf'
          3        SEND_VAL                                                 '%2508X'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $8      
          6        ASSIGN_DIM                                               !1, !0
          7        OP_DATA                                                  $8
    3     8        PRE_INC                                                  !0
          9    >   IS_SMALLER                                               !0, 100000
         10      > JMPNZ                                                    ~10, ->2
   10    11    >   INIT_FCALL                                               'microtime'
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $11     
         14        ASSIGN                                                   !2, $11
   12    15        ASSIGN                                                   !0, 0
         16      > JMP                                                      ->30
   14    17    >   FETCH_DIM_R                                      ~14     !1, !0
         18        STRLEN                                           ~15     ~14
         19        INIT_FCALL                                               'strspn'
         20        INIT_FCALL                                               'strtolower'
         21        FETCH_DIM_R                                      ~16     !1, !0
         22        SEND_VAL                                                 ~16
         23        DO_ICALL                                         $17     
         24        SEND_VAR                                                 $17
         25        SEND_VAL                                                 '0123456789abcdef'
         26        DO_ICALL                                         $18     
         27        IS_NOT_EQUAL                                     ~19     $18, ~15
         28        FREE                                                     ~19
   12    29        PRE_INC                                                  !0
         30    >   IS_SMALLER                                               !0, 100000
         31      > JMPNZ                                                    ~21, ->17
   17    32    >   INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $22     
         35        SUB                                              ~23     $22, !2
         36        ASSIGN                                                   !3, ~23
   19    37        INIT_FCALL                                               'printf'
         38        SEND_VAL                                                 '%25-11s+%250.2f%0A'
         39        SEND_VAL                                                 'STRSPN%2Bl'
         40        SEND_VAR                                                 !3
         41        DO_ICALL                                                 
   20    42        UNSET_CV                                                 !4
   24    43        INIT_FCALL                                               'microtime'
         44        SEND_VAL                                                 <true>
         45        DO_ICALL                                         $26     
         46        ASSIGN                                                   !2, $26
   26    47        ASSIGN                                                   !0, 0
         48      > JMP                                                      ->59
   28    49    >   FETCH_DIM_R                                      ~29     !1, !0
         50        STRLEN                                           ~30     ~29
         51        INIT_FCALL                                               'strspn'
         52        FETCH_DIM_R                                      ~31     !1, !0
         53        SEND_VAL                                                 ~31
         54        SEND_VAL                                                 '0123456789ABCDEFabcdef'
         55        DO_ICALL                                         $32     
         56        IS_NOT_EQUAL                                     ~33     $32, ~30
         57        FREE                                                     ~33
   26    58        PRE_INC                                                  !0
         59    >   IS_SMALLER                                               !0, 100000
         60      > JMPNZ                                                    ~35, ->49
   31    61    >   INIT_FCALL                                               'microtime'
         62        SEND_VAL                                                 <true>
         63        DO_ICALL                                         $36     
         64        SUB                                              ~37     $36, !2
         65        ASSIGN                                                   !3, ~37
   33    66        INIT_FCALL                                               'printf'
         67        SEND_VAL                                                 '%25-11s+%250.2f%0A'
         68        SEND_VAL                                                 'STRSPN'
         69        SEND_VAR                                                 !3
         70        DO_ICALL                                                 
   34    71        UNSET_CV                                                 !4
   38    72        INIT_FCALL                                               'microtime'
         73        SEND_VAL                                                 <true>
         74        DO_ICALL                                         $40     
         75        ASSIGN                                                   !2, $40
   40    76        ASSIGN                                                   !0, 0
         77      > JMP                                                      ->85
   42    78    >   INIT_FCALL                                               'preg_match'
         79        SEND_VAL                                                 '%23%5B%5E0-9a-f%5D%23i'
         80        FETCH_DIM_R                                      ~43     !1, !0
         81        SEND_VAL                                                 ~43
         82        SEND_REF                                                 !5
         83        DO_ICALL                                                 
   40    84        PRE_INC                                                  !0
         85    >   IS_SMALLER                                               !0, 100000
         86      > JMPNZ                                                    ~46, ->78
   45    87    >   INIT_FCALL                                               'microtime'
         88        SEND_VAL                                                 <true>
         89        DO_ICALL                                         $47     
         90        SUB                                              ~48     $47, !2
         91        ASSIGN                                                   !3, ~48
   47    92        INIT_FCALL                                               'printf'
         93        SEND_VAL                                                 '%25-11s+%250.2f%0A'
         94        SEND_VAL                                                 'PREG_MATCH'
         95        SEND_VAR                                                 !3
         96        DO_ICALL                                                 
   48    97        UNSET_CV                                                 !4
         98      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.54 ms | 1012 KiB | 19 Q