3v4l.org

run code in 300+ 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 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 5
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 41
Branch analysis from position: 69
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 41
Branch analysis from position: 69
Branch analysis from position: 41
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 5
Branch analysis from position: 33
Branch analysis from position: 5
filename:       /in/H8C73
function name:  (null)
number of ops:  73
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                                                      ->31
    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        INIT_FCALL                                               'preg_match'
         15        SEND_VAL                                                 '%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'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
    9    18        INIT_FCALL                                               'round'
         19        INIT_FCALL                                               'microtime'
         20        SEND_VAL                                                 <true>
         21        DO_ICALL                                         $15     
         22        MUL                                              ~16     $15, 1000
         23        SEND_VAL                                                 ~16
         24        SEND_VAL                                                 8
         25        DO_ICALL                                         $17     
         26        ASSIGN                                                   !5, $17
   10    27        SUB                                              ~19     !5, !4
         28        ADD                                              ~20     !1, ~19
         29        ASSIGN                                                   !1, ~20
    6    30        PRE_INC                                                  !3
         31    >   IS_SMALLER                                               !3, !2
         32      > JMPNZ                                                    ~23, ->5
   13    33    >   DIV                                              ~24     !1, !2
         34        CONCAT                                           ~25     'preg%3A+', ~24
         35        CONCAT                                           ~26     ~25, '%0A'
         36        ECHO                                                     ~26
   15    37        ASSIGN                                                   !1, 0
   16    38        ASSIGN                                                   !2, 1000
   17    39        ASSIGN                                                   !3, 0
         40      > JMP                                                      ->67
   18    41    >   INIT_FCALL                                               'round'
         42        INIT_FCALL                                               'microtime'
         43        SEND_VAL                                                 <true>
         44        DO_ICALL                                         $30     
         45        MUL                                              ~31     $30, 1000
         46        SEND_VAL                                                 ~31
         47        SEND_VAL                                                 8
         48        DO_ICALL                                         $32     
         49        ASSIGN                                                   !4, $32
   19    50        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
         51        SEND_VAL                                                 'Y-m-d'
         52        SEND_VAR                                                 !0
         53        DO_FCALL                                      0          
   20    54        INIT_FCALL                                               'round'
         55        INIT_FCALL                                               'microtime'
         56        SEND_VAL                                                 <true>
         57        DO_ICALL                                         $35     
         58        MUL                                              ~36     $35, 1000
         59        SEND_VAL                                                 ~36
         60        SEND_VAL                                                 8
         61        DO_ICALL                                         $37     
         62        ASSIGN                                                   !5, $37
   21    63        SUB                                              ~39     !5, !4
         64        ADD                                              ~40     !1, ~39
         65        ASSIGN                                                   !1, ~40
   17    66        PRE_INC                                                  !3
         67    >   IS_SMALLER                                               !3, !2
         68      > JMPNZ                                                    ~43, ->41
   24    69    >   DIV                                              ~44     !1, !2
         70        CONCAT                                           ~45     'DateTime%3A+', ~44
         71        ECHO                                                     ~45
         72      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.37 ms | 1009 KiB | 16 Q