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'; $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'; $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'; $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 "<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 = 66
Branch analysis from position: 66
2 jumps found. (Code = 44) Position 1 = 68, Position 2 = 59
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 114
Branch analysis from position: 114
2 jumps found. (Code = 44) Position 1 = 116, Position 2 = 101
Branch analysis from position: 116
1 jumps found. (Code = 42) Position 1 = 156
Branch analysis from position: 156
2 jumps found. (Code = 44) Position 1 = 158, Position 2 = 149
Branch analysis from position: 158
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 149
2 jumps found. (Code = 44) Position 1 = 158, Position 2 = 149
Branch analysis from position: 158
Branch analysis from position: 149
Branch analysis from position: 101
2 jumps found. (Code = 44) Position 1 = 116, Position 2 = 101
Branch analysis from position: 116
Branch analysis from position: 101
Branch analysis from position: 59
2 jumps found. (Code = 44) Position 1 = 68, Position 2 = 59
Branch analysis from position: 68
Branch analysis from position: 59
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/jWVs6
function name:  (null)
number of ops:  181
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'
   23    44        INIT_FCALL                                               'microtime'
         45        DO_ICALL                                         $39     
         46        ASSIGN                                                   !2, $39
   24    47        INIT_FCALL                                               'explode'
         48        SEND_VAL                                                 '+'
         49        SEND_VAR                                                 !2
         50        DO_ICALL                                         $41     
         51        ASSIGN                                                   !2, $41
   25    52        FETCH_DIM_R                                      ~43     !2, 1
         53        FETCH_DIM_R                                      ~44     !2, 0
         54        ADD                                              ~45     ~43, ~44
         55        ASSIGN                                                   !2, ~45
   26    56        ASSIGN                                                   !3, !2
   27    57        ASSIGN                                                   !4, 0
         58      > JMP                                                      ->66
   28    59    >   ASSIGN                                                   !5, 'http%3A%2F%2Fwww.example.com%3Ftest%3Dtest'
   29    60        INIT_FCALL                                               'explode'
         61        SEND_VAL                                                 '%3F'
         62        SEND_VAR                                                 !5
         63        DO_ICALL                                         $50     
         64        ASSIGN                                                   !5, $50
   27    65        PRE_INC                                                  !4
         66    >   IS_SMALLER                                               !4, !0
         67      > JMPNZ                                                    ~53, ->59
   31    68    >   INIT_FCALL                                               'microtime'
         69        DO_ICALL                                         $54     
         70        ASSIGN                                                   !2, $54
   32    71        INIT_FCALL                                               'explode'
         72        SEND_VAL                                                 '+'
         73        SEND_VAR                                                 !2
         74        DO_ICALL                                         $56     
         75        ASSIGN                                                   !2, $56
   33    76        FETCH_DIM_R                                      ~58     !2, 1
         77        FETCH_DIM_R                                      ~59     !2, 0
         78        ADD                                              ~60     ~58, ~59
         79        ASSIGN                                                   !2, ~60
   34    80        ASSIGN                                                   !6, !2
   35    81        SUB                                              ~63     !6, !3
         82        ASSIGN                                                   !7, ~63
   36    83        CAST                                          6  ~65     !7
         84        ASSIGN_DIM                                               !1, ~65
         85        OP_DATA                                                  'Explode'
   38    86        INIT_FCALL                                               'microtime'
         87        DO_ICALL                                         $67     
         88        ASSIGN                                                   !2, $67
   39    89        INIT_FCALL                                               'explode'
         90        SEND_VAL                                                 '+'
         91        SEND_VAR                                                 !2
         92        DO_ICALL                                         $69     
         93        ASSIGN                                                   !2, $69
   40    94        FETCH_DIM_R                                      ~71     !2, 1
         95        FETCH_DIM_R                                      ~72     !2, 0
         96        ADD                                              ~73     ~71, ~72
         97        ASSIGN                                                   !2, ~73
   41    98        ASSIGN                                                   !3, !2
   42    99        ASSIGN                                                   !4, 0
        100      > JMP                                                      ->114
   43   101    >   ASSIGN                                                   !5, 'http%3A%2F%2Fwww.example.com%3Ftest%3Dtest'
   44   102        INIT_FCALL                                               'strpos'
        103        SEND_VAR                                                 !5
        104        SEND_VAL                                                 '%3F'
        105        DO_ICALL                                         $78     
        106        ASSIGN                                                   !8, $78
   45   107        INIT_FCALL                                               'substr'
        108        SEND_VAR                                                 !5
        109        SEND_VAL                                                 0
        110        SEND_VAR                                                 !8
        111        DO_ICALL                                         $80     
        112        ASSIGN                                                   !9, $80
   42   113        PRE_INC                                                  !4
        114    >   IS_SMALLER                                               !4, !0
        115      > JMPNZ                                                    ~83, ->101
   47   116    >   INIT_FCALL                                               'microtime'
        117        DO_ICALL                                         $84     
        118        ASSIGN                                                   !2, $84
   48   119        INIT_FCALL                                               'explode'
        120        SEND_VAL                                                 '+'
        121        SEND_VAR                                                 !2
        122        DO_ICALL                                         $86     
        123        ASSIGN                                                   !2, $86
   49   124        FETCH_DIM_R                                      ~88     !2, 1
        125        FETCH_DIM_R                                      ~89     !2, 0
        126        ADD                                              ~90     ~88, ~89
        127        ASSIGN                                                   !2, ~90
   50   128        ASSIGN                                                   !6, !2
   51   129        SUB                                              ~93     !6, !3
        130        ASSIGN                                                   !7, ~93
   52   131        CAST                                          6  ~95     !7
        132        ASSIGN_DIM                                               !1, ~95
        133        OP_DATA                                                  'Substr'
   54   134        INIT_FCALL                                               'microtime'
        135        DO_ICALL                                         $97     
        136        ASSIGN                                                   !2, $97
   55   137        INIT_FCALL                                               'explode'
        138        SEND_VAL                                                 '+'
        139        SEND_VAR                                                 !2
        140        DO_ICALL                                         $99     
        141        ASSIGN                                                   !2, $99
   56   142        FETCH_DIM_R                                      ~101    !2, 1
        143        FETCH_DIM_R                                      ~102    !2, 0
        144        ADD                                              ~103    ~101, ~102
        145        ASSIGN                                                   !2, ~103
   57   146        ASSIGN                                                   !3, !2
   58   147        ASSIGN                                                   !4, 0
        148      > JMP                                                      ->156
   59   149    >   ASSIGN                                                   !5, 'http%3A%2F%2Fwww.example.com%3Ftest%3Dtest'
   60   150        INIT_FCALL                                               'strtok'
        151        SEND_VAR                                                 !5
        152        SEND_VAL                                                 '%3F'
        153        DO_ICALL                                         $108    
        154        ASSIGN                                                   !9, $108
   58   155        PRE_INC                                                  !4
        156    >   IS_SMALLER                                               !4, !0
        157      > JMPNZ                                                    ~111, ->149
   62   158    >   INIT_FCALL                                               'microtime'
        159        DO_ICALL                                         $112    
        160        ASSIGN                                                   !2, $112
   63   161        INIT_FCALL                                               'explode'
        162        SEND_VAL                                                 '+'
        163        SEND_VAR                                                 !2
        164        DO_ICALL                                         $114    
        165        ASSIGN                                                   !2, $114
   64   166        FETCH_DIM_R                                      ~116    !2, 1
        167        FETCH_DIM_R                                      ~117    !2, 0
        168        ADD                                              ~118    ~116, ~117
        169        ASSIGN                                                   !2, ~118
   65   170        ASSIGN                                                   !6, !2
   66   171        SUB                                              ~121    !6, !3
        172        ASSIGN                                                   !7, ~121
   67   173        CAST                                          6  ~123    !7
        174        ASSIGN_DIM                                               !1, ~123
        175        OP_DATA                                                  'Strtok'
   70   176        ECHO                                                     '%3Cpre%3E'
        177        INIT_FCALL                                               'print_r'
        178        SEND_VAR                                                 !1
        179        DO_ICALL                                                 
        180      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.11 ms | 1412 KiB | 27 Q