3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dateInString = '01.02.2015'; if (preg_match('/(\d{2})\.(\d{2})\.(\d{4})/', $dateInString, $m) ) { $te = strtotime(sprintf('%d-%02d-%02d 00:00:00', $m[3], $m[1], $m[2])); $ts = strtotime(sprintf('%d-01-01 00:00:00', $m[3])); echo floor(($te-$ts)/3600/24); } else { echo 'Bad format'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 37
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b2Cse
function name:  (null)
number of ops:  39
compiled vars:  !0 = $dateInString, !1 = $m, !2 = $te, !3 = $ts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '01.02.2015'
    3     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%28%5Cd%7B2%7D%29%5C.%28%5Cd%7B2%7D%29%5C.%28%5Cd%7B4%7D%29%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                         $5      
          6      > JMPZ                                                     $5, ->37
    5     7    >   INIT_FCALL                                               'strtotime'
          8        INIT_FCALL                                               'sprintf'
          9        SEND_VAL                                                 '%25d-%2502d-%2502d+00%3A00%3A00'
         10        FETCH_DIM_R                                      ~6      !1, 3
         11        SEND_VAL                                                 ~6
         12        FETCH_DIM_R                                      ~7      !1, 1
         13        SEND_VAL                                                 ~7
         14        FETCH_DIM_R                                      ~8      !1, 2
         15        SEND_VAL                                                 ~8
         16        DO_ICALL                                         $9      
         17        SEND_VAR                                                 $9
         18        DO_ICALL                                         $10     
         19        ASSIGN                                                   !2, $10
    6    20        INIT_FCALL                                               'strtotime'
         21        INIT_FCALL                                               'sprintf'
         22        SEND_VAL                                                 '%25d-01-01+00%3A00%3A00'
         23        FETCH_DIM_R                                      ~12     !1, 3
         24        SEND_VAL                                                 ~12
         25        DO_ICALL                                         $13     
         26        SEND_VAR                                                 $13
         27        DO_ICALL                                         $14     
         28        ASSIGN                                                   !3, $14
    7    29        INIT_FCALL                                               'floor'
         30        SUB                                              ~16     !2, !3
         31        DIV                                              ~17     ~16, 3600
         32        DIV                                              ~18     ~17, 24
         33        SEND_VAL                                                 ~18
         34        DO_ICALL                                         $19     
         35        ECHO                                                     $19
         36      > JMP                                                      ->38
   11    37    >   ECHO                                                     'Bad+format'
   12    38    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.64 ms | 1396 KiB | 21 Q