3v4l.org

run code in 500+ PHP versions simultaneously
<?php ini_set('date.timezone', 'America/New_York'); //current date is 2019-01-04 08:33:30 $_POST['expire'] = '2019-01-04T08:32'; $current_date = new \DateTime('2019-01-04 08:33:30'); if ($expire_date = \DateTime::createFromFormat('Y-m-d\TH:i|', $_POST['expire'])) { if ($expire_date < $current_date) { /* example purposes only */ $diff = $expire_date->diff($current_date); echo 'Expired ' . $diff->format('%y years %m months %d days %h hours %i minutes %s seconds') . ' ago'; //do the thing } } else { die('Invalid Date Format Provided'); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 32
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 31
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
Branch analysis from position: 32
1 jumps found. (Code = 61) Position 1 = -2
filename:       /in/EelYY
function name:  (null)
number of ops:  36
compiled vars:  !0 = $current_date, !1 = $expire_date, !2 = $diff
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'ini_set'
          1        SEND_VAL                                                     'date.timezone'
          2        SEND_VAL                                                     'America%2FNew_York'
          3        DO_ICALL                                                     
    6     4        FETCH_W                          global              $4      '_POST'
          5        ASSIGN_DIM                                                   $4, 'expire'
          6        OP_DATA                                                      '2019-01-04T08%3A32'
    8     7        NEW                                                  $6      'DateTime'
          8        SEND_VAL_EX                                                  '2019-01-04+08%3A33%3A30'
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !0, $6
    9    11        INIT_STATIC_METHOD_CALL                                      'DateTime', 'createFromFormat'
         12        SEND_VAL                                                     'Y-m-d%5CTH%3Ai%7C'
         13        FETCH_R                          global              ~9      '_POST'
         14        FETCH_DIM_R                                          ~10     ~9, 'expire'
         15        SEND_VAL                                                     ~10
         16        DO_FCALL                                          0  $11     
         17        ASSIGN                                               ~12     !1, $11
         18      > JMPZ                                                         ~12, ->32
   10    19    >   IS_SMALLER                                                   !1, !0
         20      > JMPZ                                                         ~13, ->31
   12    21    >   INIT_METHOD_CALL                                             !1, 'diff'
         22        SEND_VAR_EX                                                  !0
         23        DO_FCALL                                          0  $14     
         24        ASSIGN                                                       !2, $14
   13    25        INIT_METHOD_CALL                                             !2, 'format'
         26        SEND_VAL_EX                                                  '%25y+years+%25m+months+%25d+days+%25h+hours+%25i+minutes+%25s+seconds'
         27        DO_FCALL                                          0  $16     
         28        CONCAT                                               ~17     'Expired+', $16
         29        CONCAT                                               ~18     ~17, '+ago'
         30        ECHO                                                         ~18
    9    31    > > JMP                                                          ->35
   17    32    > > INIT_FCALL                                                   'exit'
         33*       SEND_VAL                                                     'Invalid+Date+Format+Provided'
         34*       DO_ICALL                                                     
   18    35    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
231.08 ms | 2119 KiB | 15 Q