3v4l.org

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

Generated using Vulcan Logic Dumper, using php 7.3.0