3v4l.org

run code in 500+ PHP versions simultaneously
<?php $date="2017-09-11"; $time = 0; $loops = 1000; for ($i = 0; $i < $loops; $i++) { $time1 = round(microtime(true) * 1000, 8); preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$date); $time2 = round(microtime(true) * 1000, 8); $time = $time + ($time2 - $time1); } echo 'preg: ' . ($time / $loops) . PHP_EOL; $time = 0; $loops = 1000; for ($i = 0; $i < $loops; $i++) { $time1 = round(microtime(true) * 1000, 8); DateTime::createFromFormat("Y-m-d", $date); $time2 = round(microtime(true) * 1000, 8); $time = $time + ($time2 - $time1); } echo 'DateTime: ' . ($time / $loops);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 5
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
2 jumps found. (Code = 44) Position 1 = 67, Position 2 = 39
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 67, Position 2 = 39
Branch analysis from position: 67
Branch analysis from position: 39
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 5
Branch analysis from position: 31
Branch analysis from position: 5
filename:       /in/H8C73
function name:  (null)
number of ops:  71
compiled vars:  !0 = $date, !1 = $time, !2 = $loops, !3 = $i, !4 = $time1, !5 = $time2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '2017-09-11'
    4     1        ASSIGN                                                       !1, 0
    5     2        ASSIGN                                                       !2, 1000
    6     3        ASSIGN                                                       !3, 0
          4      > JMP                                                          ->29
    7     5    >   INIT_FCALL                                                   'round'
          6        INIT_FCALL                                                   'microtime'
          7        SEND_VAL                                                     <true>
          8        DO_ICALL                                             $10     
          9        MUL                                                  ~11     $10, 1000
         10        SEND_VAL                                                     ~11
         11        SEND_VAL                                                     8
         12        DO_ICALL                                             $12     
         13        ASSIGN                                                       !4, $12
    8    14        FRAMELESS_ICALL_2                preg_match          ~14     '%2F%5E%5B0-9%5D%7B4%7D-%280%5B1-9%5D%7C1%5B0-2%5D%29-%280%5B1-9%5D%7C%5B1-2%5D%5B0-9%5D%7C3%5B0-1%5D%29%24%2F', !0
         15        FREE                                                         ~14
    9    16        INIT_FCALL                                                   'round'
         17        INIT_FCALL                                                   'microtime'
         18        SEND_VAL                                                     <true>
         19        DO_ICALL                                             $15     
         20        MUL                                                  ~16     $15, 1000
         21        SEND_VAL                                                     ~16
         22        SEND_VAL                                                     8
         23        DO_ICALL                                             $17     
         24        ASSIGN                                                       !5, $17
   10    25        SUB                                                  ~19     !5, !4
         26        ADD                                                  ~20     !1, ~19
         27        ASSIGN                                                       !1, ~20
    6    28        PRE_INC                                                      !3
         29    >   IS_SMALLER                                                   !3, !2
         30      > JMPNZ                                                        ~23, ->5
   13    31    >   DIV                                                  ~24     !1, !2
         32        CONCAT                                               ~25     'preg%3A+', ~24
         33        CONCAT                                               ~26     ~25, '%0A'
         34        ECHO                                                         ~26
   15    35        ASSIGN                                                       !1, 0
   16    36        ASSIGN                                                       !2, 1000
   17    37        ASSIGN                                                       !3, 0
         38      > JMP                                                          ->65
   18    39    >   INIT_FCALL                                                   'round'
         40        INIT_FCALL                                                   'microtime'
         41        SEND_VAL                                                     <true>
         42        DO_ICALL                                             $30     
         43        MUL                                                  ~31     $30, 1000
         44        SEND_VAL                                                     ~31
         45        SEND_VAL                                                     8
         46        DO_ICALL                                             $32     
         47        ASSIGN                                                       !4, $32
   19    48        INIT_STATIC_METHOD_CALL                                      'DateTime', 'createFromFormat'
         49        SEND_VAL                                                     'Y-m-d'
         50        SEND_VAR                                                     !0
         51        DO_FCALL                                          0          
   20    52        INIT_FCALL                                                   'round'
         53        INIT_FCALL                                                   'microtime'
         54        SEND_VAL                                                     <true>
         55        DO_ICALL                                             $35     
         56        MUL                                                  ~36     $35, 1000
         57        SEND_VAL                                                     ~36
         58        SEND_VAL                                                     8
         59        DO_ICALL                                             $37     
         60        ASSIGN                                                       !5, $37
   21    61        SUB                                                  ~39     !5, !4
         62        ADD                                                  ~40     !1, ~39
         63        ASSIGN                                                       !1, ~40
   17    64        PRE_INC                                                      !3
         65    >   IS_SMALLER                                                   !3, !2
         66      > JMPNZ                                                        ~43, ->39
   24    67    >   DIV                                                  ~44     !1, !2
         68        CONCAT                                               ~45     'DateTime%3A+', ~44
         69        ECHO                                                         ~45
         70      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
147.89 ms | 1445 KiB | 15 Q