3v4l.org

run code in 500+ PHP versions simultaneously
<?php // mb_strlen (match). $string = 'foo'; $start = hrtime(TRUE); for ($i = 0 ; $i < 100000 ; $i++) { $output = !mb_strlen($string); } $end = hrtime(TRUE); echo PHP_EOL . sprintf('mb_strlen (match) result: %s', $output ? 'TRUE' : 'FALSE'); echo PHP_EOL . sprintf('mb_strlen (match): %s', (($end - $start) / 1000000000)); // mb_strlenn (miss). $string = ''; $start = hrtime(TRUE); for ($i = 0 ; $i < 100000 ; $i++) { $output = !mb_strlen($string); } $end = hrtime(TRUE); echo PHP_EOL . sprintf('mb_strlen (miss) result: %s', $output ? 'TRUE' : 'FALSE'); echo PHP_EOL . sprintf('mb_strlen (miss): %s', (($end - $start) / 1000000000)); echo PHP_EOL; // empty (match). $string = 'foo'; $start = hrtime(TRUE); for ($i = 0 ; $i < 100000 ; $i++) { $output = empty($string); } $end = hrtime(TRUE); echo PHP_EOL . sprintf('empty (match) result: %s', $output ? 'TRUE' : 'FALSE'); echo PHP_EOL . sprintf('empty (match): %s', (($end - $start) / 1000000000)); // mb_strlenn (miss). $string = ''; $start = hrtime(TRUE); for ($i = 0 ; $i < 100000 ; $i++) { $output = empty($string); } $end = hrtime(TRUE); echo PHP_EOL . sprintf('empty (miss) result: %s', $output ? 'TRUE' : 'FALSE'); echo PHP_EOL . sprintf('empty (miss): %s', (($end - $start) / 1000000000)); echo PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 7
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 40
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 55
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 77
Branch analysis from position: 77
2 jumps found. (Code = 44) Position 1 = 79, Position 2 = 74
Branch analysis from position: 79
2 jumps found. (Code = 43) Position 1 = 84, Position 2 = 86
Branch analysis from position: 84
1 jumps found. (Code = 42) Position 1 = 87
Branch analysis from position: 87
1 jumps found. (Code = 42) Position 1 = 107
Branch analysis from position: 107
2 jumps found. (Code = 44) Position 1 = 109, Position 2 = 104
Branch analysis from position: 109
2 jumps found. (Code = 43) Position 1 = 114, Position 2 = 116
Branch analysis from position: 114
1 jumps found. (Code = 42) Position 1 = 117
Branch analysis from position: 117
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 116
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 104
2 jumps found. (Code = 44) Position 1 = 109, Position 2 = 104
Branch analysis from position: 109
Branch analysis from position: 104
Branch analysis from position: 86
1 jumps found. (Code = 42) Position 1 = 107
Branch analysis from position: 107
Branch analysis from position: 74
2 jumps found. (Code = 44) Position 1 = 79, Position 2 = 74
Branch analysis from position: 79
Branch analysis from position: 74
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 77
Branch analysis from position: 77
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 40
Branch analysis from position: 48
Branch analysis from position: 40
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 7
Branch analysis from position: 15
Branch analysis from position: 7
filename:       /in/sTjbp
function name:  (null)
number of ops:  129
compiled vars:  !0 = $string, !1 = $start, !2 = $i, !3 = $output, !4 = $end
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                       !0, 'foo'
    6     1        INIT_FCALL                                                   'hrtime'
          2        SEND_VAL                                                     <true>
          3        DO_ICALL                                             $6      
          4        ASSIGN                                                       !1, $6
    8     5        ASSIGN                                                       !2, 0
          6      > JMP                                                          ->13
    9     7    >   INIT_FCALL                                                   'mb_strlen'
          8        SEND_VAR                                                     !0
          9        DO_ICALL                                             $9      
         10        BOOL_NOT                                             ~10     $9
         11        ASSIGN                                                       !3, ~10
    8    12        PRE_INC                                                      !2
         13    >   IS_SMALLER                                                   !2, 100000
         14      > JMPNZ                                                        ~13, ->7
   12    15    >   INIT_FCALL                                                   'hrtime'
         16        SEND_VAL                                                     <true>
         17        DO_ICALL                                             $14     
         18        ASSIGN                                                       !4, $14
   14    19      > JMPZ                                                         !3, ->22
         20    >   QM_ASSIGN                                            ~16     'TRUE'
         21      > JMP                                                          ->23
         22    >   QM_ASSIGN                                            ~16     'FALSE'
         23    >   NOP                                                          
         24        FAST_CONCAT                                          ~17     'mb_strlen+%28match%29+result%3A+', ~16
         25        CONCAT                                               ~18     '%0A', ~17
         26        ECHO                                                         ~18
   15    27        SUB                                                  ~19     !4, !1
         28        DIV                                                  ~20     ~19, 1000000000
         29        NOP                                                          
         30        FAST_CONCAT                                          ~21     'mb_strlen+%28match%29%3A+', ~20
         31        CONCAT                                               ~22     '%0A', ~21
         32        ECHO                                                         ~22
   19    33        ASSIGN                                                       !0, ''
   20    34        INIT_FCALL                                                   'hrtime'
         35        SEND_VAL                                                     <true>
         36        DO_ICALL                                             $24     
         37        ASSIGN                                                       !1, $24
   22    38        ASSIGN                                                       !2, 0
         39      > JMP                                                          ->46
   23    40    >   INIT_FCALL                                                   'mb_strlen'
         41        SEND_VAR                                                     !0
         42        DO_ICALL                                             $27     
         43        BOOL_NOT                                             ~28     $27
         44        ASSIGN                                                       !3, ~28
   22    45        PRE_INC                                                      !2
         46    >   IS_SMALLER                                                   !2, 100000
         47      > JMPNZ                                                        ~31, ->40
   26    48    >   INIT_FCALL                                                   'hrtime'
         49        SEND_VAL                                                     <true>
         50        DO_ICALL                                             $32     
         51        ASSIGN                                                       !4, $32
   28    52      > JMPZ                                                         !3, ->55
         53    >   QM_ASSIGN                                            ~34     'TRUE'
         54      > JMP                                                          ->56
         55    >   QM_ASSIGN                                            ~34     'FALSE'
         56    >   NOP                                                          
         57        FAST_CONCAT                                          ~35     'mb_strlen+%28miss%29+result%3A+', ~34
         58        CONCAT                                               ~36     '%0A', ~35
         59        ECHO                                                         ~36
   29    60        SUB                                                  ~37     !4, !1
         61        DIV                                                  ~38     ~37, 1000000000
         62        NOP                                                          
         63        FAST_CONCAT                                          ~39     'mb_strlen+%28miss%29%3A+', ~38
         64        CONCAT                                               ~40     '%0A', ~39
         65        ECHO                                                         ~40
   30    66        ECHO                                                         '%0A'
   34    67        ASSIGN                                                       !0, 'foo'
   35    68        INIT_FCALL                                                   'hrtime'
         69        SEND_VAL                                                     <true>
         70        DO_ICALL                                             $42     
         71        ASSIGN                                                       !1, $42
   37    72        ASSIGN                                                       !2, 0
         73      > JMP                                                          ->77
   38    74    >   ISSET_ISEMPTY_CV                                     ~45     !0
         75        ASSIGN                                                       !3, ~45
   37    76        PRE_INC                                                      !2
         77    >   IS_SMALLER                                                   !2, 100000
         78      > JMPNZ                                                        ~48, ->74
   41    79    >   INIT_FCALL                                                   'hrtime'
         80        SEND_VAL                                                     <true>
         81        DO_ICALL                                             $49     
         82        ASSIGN                                                       !4, $49
   43    83      > JMPZ                                                         !3, ->86
         84    >   QM_ASSIGN                                            ~51     'TRUE'
         85      > JMP                                                          ->87
         86    >   QM_ASSIGN                                            ~51     'FALSE'
         87    >   NOP                                                          
         88        FAST_CONCAT                                          ~52     'empty+%28match%29+result%3A+', ~51
         89        CONCAT                                               ~53     '%0A', ~52
         90        ECHO                                                         ~53
   44    91        SUB                                                  ~54     !4, !1
         92        DIV                                                  ~55     ~54, 1000000000
         93        NOP                                                          
         94        FAST_CONCAT                                          ~56     'empty+%28match%29%3A+', ~55
         95        CONCAT                                               ~57     '%0A', ~56
         96        ECHO                                                         ~57
   48    97        ASSIGN                                                       !0, ''
   49    98        INIT_FCALL                                                   'hrtime'
         99        SEND_VAL                                                     <true>
        100        DO_ICALL                                             $59     
        101        ASSIGN                                                       !1, $59
   51   102        ASSIGN                                                       !2, 0
        103      > JMP                                                          ->107
   52   104    >   ISSET_ISEMPTY_CV                                     ~62     !0
        105        ASSIGN                                                       !3, ~62
   51   106        PRE_INC                                                      !2
        107    >   IS_SMALLER                                                   !2, 100000
        108      > JMPNZ                                                        ~65, ->104
   55   109    >   INIT_FCALL                                                   'hrtime'
        110        SEND_VAL                                                     <true>
        111        DO_ICALL                                             $66     
        112        ASSIGN                                                       !4, $66
   57   113      > JMPZ                                                         !3, ->116
        114    >   QM_ASSIGN                                            ~68     'TRUE'
        115      > JMP                                                          ->117
        116    >   QM_ASSIGN                                            ~68     'FALSE'
        117    >   NOP                                                          
        118        FAST_CONCAT                                          ~69     'empty+%28miss%29+result%3A+', ~68
        119        CONCAT                                               ~70     '%0A', ~69
        120        ECHO                                                         ~70
   58   121        SUB                                                  ~71     !4, !1
        122        DIV                                                  ~72     ~71, 1000000000
        123        NOP                                                          
        124        FAST_CONCAT                                          ~73     'empty+%28miss%29%3A+', ~72
        125        CONCAT                                               ~74     '%0A', ~73
        126        ECHO                                                         ~74
   59   127        ECHO                                                         '%0A'
   60   128      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
126.9 ms | 492 KiB | 9 Q