3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $lastDate = '1452504837'; $interval = 'P0Y0M3D'; $interval = new DateInterval($interval); echo 'Interval: '.$interval->format('%y years, %m months, %d days %H:%I:%S')."\n"; $lastJob = new \Datetime(); $lastJob->setTimestamp($lastDate); $currentJob = new \Datetime(); $nextJob = $lastJob->add($interval); echo 'Last Sent: '.$lastJob->format('Y/m/d').' | Next Job: '.$nextJob->format('Y/m/d') . ' | Today: '.$currentJob->format('Y/m/d')."\n"; if ($nextJob <= $currentJob) { echo 'ready to send'; } else { echo 'not ready to send.'; }
based on QSL2P
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 43, Position 2 = 45
Branch analysis from position: 43
Jump found. Position 1 = 46
Branch analysis from position: 46
Jump found. Position 1 = -2
Branch analysis from position: 45
Jump found. Position 1 = -2
filename:       /in/GIgq5
function name:  (null)
number of ops:  47
compiled vars:  !0 = $lastDate, !1 = $interval, !2 = $lastJob, !3 = $currentJob, !4 = $nextJob
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   ASSIGN                                                   !0, '1452504837'
   3     1        ASSIGN                                                   !1, 'P0Y0M3D'
   4     2        NEW                                              $7      :-4
         3        SEND_VAR_EX                                              !1
         4        DO_FCALL                                      0          
         5        ASSIGN                                                   !1, $7
   5     6        INIT_METHOD_CALL                                         !1, 'format'
         7        SEND_VAL_EX                                              '%25y+years%2C+%25m+months%2C+%25d+days+%25H%3A%25I%3A%25S'
         8        DO_FCALL                                      0  $10     
         9        CONCAT                                           ~11     'Interval%3A+', $10
        10        CONCAT                                           ~12     ~11, '%0A'
        11        ECHO                                                     ~12
   6    12        NEW                                              $13     :3
        13        DO_FCALL                                      0          
        14        ASSIGN                                                   !2, $13
   7    15        INIT_METHOD_CALL                                         !2, 'setTimestamp'
        16        SEND_VAR_EX                                              !0
        17        DO_FCALL                                      0          
   8    18        NEW                                              $17     :7
        19        DO_FCALL                                      0          
        20        ASSIGN                                                   !3, $17
   9    21        INIT_METHOD_CALL                                         !2, 'add'
        22        SEND_VAR_EX                                              !1
        23        DO_FCALL                                      0  $20     
        24        ASSIGN                                                   !4, $20
  10    25        INIT_METHOD_CALL                                         !2, 'format'
        26        SEND_VAL_EX                                              'Y%2Fm%2Fd'
        27        DO_FCALL                                      0  $22     
        28        CONCAT                                           ~23     'Last+Sent%3A+', $22
        29        CONCAT                                           ~24     ~23, '+%7C+Next+Job%3A+'
        30        INIT_METHOD_CALL                                         !4, 'format'
        31        SEND_VAL_EX                                              'Y%2Fm%2Fd'
        32        DO_FCALL                                      0  $25     
        33        CONCAT                                           ~26     ~24, $25
        34        CONCAT                                           ~27     ~26, '+%7C+Today%3A+'
        35        INIT_METHOD_CALL                                         !3, 'format'
        36        SEND_VAL_EX                                              'Y%2Fm%2Fd'
        37        DO_FCALL                                      0  $28     
        38        CONCAT                                           ~29     ~27, $28
        39        CONCAT                                           ~30     ~29, '%0A'
        40        ECHO                                                     ~30
  12    41        IS_SMALLER_OR_EQUAL                              ~31     !4, !3
        42      > JMPZ                                                     ~31, ->45
  13    43    >   ECHO                                                     'ready+to+send'
        44      > JMP                                                      ->46
  15    45    >   ECHO                                                     'not+ready+to+send.'
        46    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.3.0