3v4l.org

run code in 300+ PHP versions simultaneously
<?php $number_of_tests = 40000; $time_array = array(); $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; for($i = 0; $i < $number_of_tests; $i++){ $str = "http://www.example.com?test=test"; preg_replace('/\\?.*/', '', $str); } $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); $time_array[ (string) $totaltime ] = 'Regexp'; echo "regexp execution time: ".$totaltime." seconds; "; $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; for($i = 0; $i < $number_of_tests; $i++){ $str = "http://www.example.com?test=test"; $str = explode('?', $str); } $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); $time_array[ (string) $totaltime ] = 'Explode'; echo "explode execution time: ".$totaltime." seconds; "; $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; for($i = 0; $i < $number_of_tests; $i++){ $str = "http://www.example.com?test=test"; $qPos = strpos($str, "?"); $url_without_query_string = substr($str, 0, $qPos); } $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); $time_array[ (string) $totaltime ] = 'Substr'; echo "strpos execution time: ".$totaltime." seconds; "; $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; for($i = 0; $i < $number_of_tests; $i++){ $str = "http://www.example.com?test=test"; $url_without_query_string = strtok($str, '?'); } $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); $time_array[ (string) $totaltime ] = 'Strtok'; echo "tok execution time: ".$totaltime." seconds; "; echo "<pre>"; print_r($time_array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 17
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
2 jumps found. (Code = 44) Position 1 = 71, Position 2 = 62
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 120
Branch analysis from position: 120
2 jumps found. (Code = 44) Position 1 = 122, Position 2 = 107
Branch analysis from position: 122
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
2 jumps found. (Code = 44) Position 1 = 167, Position 2 = 158
Branch analysis from position: 167
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 158
2 jumps found. (Code = 44) Position 1 = 167, Position 2 = 158
Branch analysis from position: 167
Branch analysis from position: 158
Branch analysis from position: 107
2 jumps found. (Code = 44) Position 1 = 122, Position 2 = 107
Branch analysis from position: 122
Branch analysis from position: 107
Branch analysis from position: 62
2 jumps found. (Code = 44) Position 1 = 71, Position 2 = 62
Branch analysis from position: 71
Branch analysis from position: 62
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 17
Branch analysis from position: 26
Branch analysis from position: 17
filename:       /in/gbruk
function name:  (null)
number of ops:  193
compiled vars:  !0 = $number_of_tests, !1 = $time_array, !2 = $mtime, !3 = $starttime, !4 = $i, !5 = $str, !6 = $endtime, !7 = $totaltime, !8 = $qPos, !9 = $url_without_query_string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 40000
    5     1        ASSIGN                                                   !1, <array>
    7     2        INIT_FCALL                                               'microtime'
          3        DO_ICALL                                         $12     
          4        ASSIGN                                                   !2, $12
    8     5        INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 '+'
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $14     
          9        ASSIGN                                                   !2, $14
    9    10        FETCH_DIM_R                                      ~16     !2, 1
         11        FETCH_DIM_R                                      ~17     !2, 0
         12        ADD                                              ~18     ~16, ~17
         13        ASSIGN                                                   !2, ~18
   10    14        ASSIGN                                                   !3, !2
   12    15        ASSIGN                                                   !4, 0
         16      > JMP                                                      ->24
   13    17    >   ASSIGN                                                   !5, 'http%3A%2F%2Fwww.example.com%3Ftest%3Dtest'
   14    18        INIT_FCALL                                               'preg_replace'
         19        SEND_VAL                                                 '%2F%5C%3F.%2A%2F'
         20        SEND_VAL                                                 ''
         21        SEND_VAR                                                 !5
         22        DO_ICALL                                                 
   12    23        PRE_INC                                                  !4
         24    >   IS_SMALLER                                               !4, !0
         25      > JMPNZ                                                    ~25, ->17
   16    26    >   INIT_FCALL                                               'microtime'
         27        DO_ICALL                                         $26     
         28        ASSIGN                                                   !2, $26
   17    29        INIT_FCALL                                               'explode'
         30        SEND_VAL                                                 '+'
         31        SEND_VAR                                                 !2
         32        DO_ICALL                                         $28     
         33        ASSIGN                                                   !2, $28
   18    34        FETCH_DIM_R                                      ~30     !2, 1
         35        FETCH_DIM_R                                      ~31     !2, 0
         36        ADD                                              ~32     ~30, ~31
         37        ASSIGN                                                   !2, ~32
   19    38        ASSIGN                                                   !6, !2
   20    39        SUB                                              ~35     !6, !3
         40        ASSIGN                                                   !7, ~35
   21    41        CAST                                          6  ~37     !7
         42        ASSIGN_DIM                                               !1, ~37
         43        OP_DATA                                                  'Regexp'
   22    44        CONCAT                                           ~39     'regexp+execution+time%3A+', !7
         45        CONCAT                                           ~40     ~39, '+seconds%3B+'
         46        ECHO                                                     ~40
   24    47        INIT_FCALL                                               'microtime'
         48        DO_ICALL                                         $41     
         49        ASSIGN                                                   !2, $41
   25    50        INIT_FCALL                                               'explode'
         51        SEND_VAL                                                 '+'
         52        SEND_VAR                                                 !2
         53        DO_ICALL                                         $43     
         54        ASSIGN                                                   !2, $43
   26    55        FETCH_DIM_R                                      ~45     !2, 1
         56        FETCH_DIM_R                                      ~46     !2, 0
         57        ADD                                              ~47     ~45, ~46
         58        ASSIGN                                                   !2, ~47
   27    59        ASSIGN                                                   !3, !2
   28    60        ASSIGN                                                   !4, 0
         61      > JMP                                                      ->69
   29    62    >   ASSIGN                                                   !5, 'http%3A%2F%2Fwww.example.com%3Ftest%3Dtest'
   30    63        INIT_FCALL                                               'explode'
         64        SEND_VAL                                                 '%3F'
         65        SEND_VAR                                                 !5
         66        DO_ICALL                                         $52     
         67        ASSIGN                                                   !5, $52
   28    68        PRE_INC                                                  !4
         69    >   IS_SMALLER                                               !4, !0
         70      > JMPNZ                                                    ~55, ->62
   32    71    >   INIT_FCALL                                               'microtime'
         72        DO_ICALL                                         $56     
         73        ASSIGN                                                   !2, $56
   33    74        INIT_FCALL                                               'explode'
         75        SEND_VAL                                                 '+'
         76        SEND_VAR                                                 !2
         77        DO_ICALL                                         $58     
         78        ASSIGN                                                   !2, $58
   34    79        FETCH_DIM_R                                      ~60     !2, 1
         80        FETCH_DIM_R                                      ~61     !2, 0
         81        ADD                                              ~62     ~60, ~61
         82        ASSIGN                                                   !2, ~62
   35    83        ASSIGN                                                   !6, !2
   36    84        SUB                                              ~65     !6, !3
         85        ASSIGN                                                   !7, ~65
   37    86        CAST                                          6  ~67     !7
         87        ASSIGN_DIM                                               !1, ~67
         88        OP_DATA                                                  'Explode'
   38    89        CONCAT                                           ~69     'explode+execution+time%3A+', !7
         90        CONCAT                                           ~70     ~69, '+seconds%3B+'
         91        ECHO                                                     ~70
   40    92        INIT_FCALL                                               'microtime'
         93        DO_ICALL                                         $71     
         94        ASSIGN                                                   !2, $71
   41    95        INIT_FCALL                                               'explode'
         96        SEND_VAL                                                 '+'
         97        SEND_VAR                                                 !2
         98        DO_ICALL                                         $73     
         99        ASSIGN                                                   !2, $73
   42   100        FETCH_DIM_R                                      ~75     !2, 1
        101        FETCH_DIM_R                                      ~76     !2, 0
        102        ADD                                              ~77     ~75, ~76
        103        ASSIGN                                                   !2, ~77
   43   104        ASSIGN                                                   !3, !2
   44   105        ASSIGN                                                   !4, 0
        106      > JMP                                                      ->120
   45   107    >   ASSIGN                                                   !5, 'http%3A%2F%2Fwww.example.com%3Ftest%3Dtest'
   46   108        INIT_FCALL                                               'strpos'
        109        SEND_VAR                                                 !5
        110        SEND_VAL                                                 '%3F'
        111        DO_ICALL                                         $82     
        112        ASSIGN                                                   !8, $82
   47   113        INIT_FCALL                                               'substr'
        114        SEND_VAR                                                 !5
        115        SEND_VAL                                                 0
        116        SEND_VAR                                                 !8
        117        DO_ICALL                                         $84     
        118        ASSIGN                                                   !9, $84
   44   119        PRE_INC                                                  !4
        120    >   IS_SMALLER                                               !4, !0
        121      > JMPNZ                                                    ~87, ->107
   49   122    >   INIT_FCALL                                               'microtime'
        123        DO_ICALL                                         $88     
        124        ASSIGN                                                   !2, $88
   50   125        INIT_FCALL                                               'explode'
        126        SEND_VAL                                                 '+'
        127        SEND_VAR                                                 !2
        128        DO_ICALL                                         $90     
        129        ASSIGN                                                   !2, $90
   51   130        FETCH_DIM_R                                      ~92     !2, 1
        131        FETCH_DIM_R                                      ~93     !2, 0
        132        ADD                                              ~94     ~92, ~93
        133        ASSIGN                                                   !2, ~94
   52   134        ASSIGN                                                   !6, !2
   53   135        SUB                                              ~97     !6, !3
        136        ASSIGN                                                   !7, ~97
   54   137        CAST                                          6  ~99     !7
        138        ASSIGN_DIM                                               !1, ~99
        139        OP_DATA                                                  'Substr'
   55   140        CONCAT                                           ~101    'strpos+execution+time%3A+', !7
        141        CONCAT                                           ~102    ~101, '+seconds%3B+'
        142        ECHO                                                     ~102
   57   143        INIT_FCALL                                               'microtime'
        144        DO_ICALL                                         $103    
        145        ASSIGN                                                   !2, $103
   58   146        INIT_FCALL                                               'explode'
        147        SEND_VAL                                                 '+'
        148        SEND_VAR                                                 !2
        149        DO_ICALL                                         $105    
        150        ASSIGN                                                   !2, $105
   59   151        FETCH_DIM_R                                      ~107    !2, 1
        152        FETCH_DIM_R                                      ~108    !2, 0
        153        ADD                                              ~109    ~107, ~108
        154        ASSIGN                                                   !2, ~109
   60   155        ASSIGN                                                   !3, !2
   61   156        ASSIGN                                                   !4, 0
        157      > JMP                                                      ->165
   62   158    >   ASSIGN                                                   !5, 'http%3A%2F%2Fwww.example.com%3Ftest%3Dtest'
   63   159        INIT_FCALL                                               'strtok'
        160        SEND_VAR                                                 !5
        161        SEND_VAL                                                 '%3F'
        162        DO_ICALL                                         $114    
        163        ASSIGN                                                   !9, $114
   61   164        PRE_INC                                                  !4
        165    >   IS_SMALLER                                               !4, !0
        166      > JMPNZ                                                    ~117, ->158
   65   167    >   INIT_FCALL                                               'microtime'
        168        DO_ICALL                                         $118    
        169        ASSIGN                                                   !2, $118
   66   170        INIT_FCALL                                               'explode'
        171        SEND_VAL                                                 '+'
        172        SEND_VAR                                                 !2
        173        DO_ICALL                                         $120    
        174        ASSIGN                                                   !2, $120
   67   175        FETCH_DIM_R                                      ~122    !2, 1
        176        FETCH_DIM_R                                      ~123    !2, 0
        177        ADD                                              ~124    ~122, ~123
        178        ASSIGN                                                   !2, ~124
   68   179        ASSIGN                                                   !6, !2
   69   180        SUB                                              ~127    !6, !3
        181        ASSIGN                                                   !7, ~127
   70   182        CAST                                          6  ~129    !7
        183        ASSIGN_DIM                                               !1, ~129
        184        OP_DATA                                                  'Strtok'
   71   185        CONCAT                                           ~131    'tok+execution+time%3A+', !7
        186        CONCAT                                           ~132    ~131, '+seconds%3B+'
        187        ECHO                                                     ~132
   74   188        ECHO                                                     '%3Cpre%3E'
        189        INIT_FCALL                                               'print_r'
        190        SEND_VAR                                                 !1
        191        DO_ICALL                                                 
        192      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.77 ms | 1412 KiB | 27 Q