3v4l.org

run code in 300+ PHP versions simultaneously
<?php $emember_flag = 0; date_default_timezone_set('Asia/Singapore'); define('LF', "\n"); define('DATE_FORMAT', 'Y-m-d H:i:s'); # The format 'today' works the same as 'now' except the time is set to 00:00:00 # More info at http://sg3.php.net/manual/en/datetime.formats.relative.php $end_date = new DateTime('today'); # Effective end date is the end of the last day of current month. # But we are using 'first day of next month' because our comparison uses < not <= $end_date->modify('first day of next month'); $sumend_timestamp = $end_date->getTimestamp(); if ($emember_flag) : $intervalSpec = 'P3M'; else : $intervalSpec = 'P12M'; endif; $upgrade_interval = new DateInterval($intervalSpec); $start_date = clone $end_date; $start_date->sub($upgrade_interval); $sumstart_timestamp = $start_date->getTimestamp(); echo date(DATE_FORMAT, $sumend_timestamp) . LF; echo date(DATE_FORMAT, $sumstart_timestamp) . LF;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oUZkL
function name:  (null)
number of ops:  55
compiled vars:  !0 = $emember_flag, !1 = $end_date, !2 = $sumend_timestamp, !3 = $intervalSpec, !4 = $upgrade_interval, !5 = $start_date, !6 = $sumstart_timestamp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 0
    4     1        INIT_FCALL                                               'date_default_timezone_set'
          2        SEND_VAL                                                 'Asia%2FSingapore'
          3        DO_ICALL                                                 
    6     4        INIT_FCALL                                               'define'
          5        SEND_VAL                                                 'LF'
          6        SEND_VAL                                                 '%0A'
          7        DO_ICALL                                                 
    7     8        INIT_FCALL                                               'define'
          9        SEND_VAL                                                 'DATE_FORMAT'
         10        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         11        DO_ICALL                                                 
   11    12        NEW                                              $11     'DateTime'
         13        SEND_VAL_EX                                              'today'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !1, $11
   14    16        INIT_METHOD_CALL                                         !1, 'modify'
         17        SEND_VAL_EX                                              'first+day+of+next+month'
         18        DO_FCALL                                      0          
   15    19        INIT_METHOD_CALL                                         !1, 'getTimestamp'
         20        DO_FCALL                                      0  $15     
         21        ASSIGN                                                   !2, $15
   17    22      > JMPZ                                                     !0, ->25
   18    23    >   ASSIGN                                                   !3, 'P3M'
         24      > JMP                                                      ->26
   20    25    >   ASSIGN                                                   !3, 'P12M'
   23    26    >   NEW                                              $19     'DateInterval'
         27        SEND_VAR_EX                                              !3
         28        DO_FCALL                                      0          
         29        ASSIGN                                                   !4, $19
   25    30        CLONE                                            ~22     !1
         31        ASSIGN                                                   !5, ~22
   26    32        INIT_METHOD_CALL                                         !5, 'sub'
         33        SEND_VAR_EX                                              !4
         34        DO_FCALL                                      0          
   27    35        INIT_METHOD_CALL                                         !5, 'getTimestamp'
         36        DO_FCALL                                      0  $25     
         37        ASSIGN                                                   !6, $25
   29    38        INIT_FCALL                                               'date'
         39        FETCH_CONSTANT                                   ~27     'DATE_FORMAT'
         40        SEND_VAL                                                 ~27
         41        SEND_VAR                                                 !2
         42        DO_ICALL                                         $28     
         43        FETCH_CONSTANT                                   ~29     'LF'
         44        CONCAT                                           ~30     $28, ~29
         45        ECHO                                                     ~30
   30    46        INIT_FCALL                                               'date'
         47        FETCH_CONSTANT                                   ~31     'DATE_FORMAT'
         48        SEND_VAL                                                 ~31
         49        SEND_VAR                                                 !6
         50        DO_ICALL                                         $32     
         51        FETCH_CONSTANT                                   ~33     'LF'
         52        CONCAT                                           ~34     $32, ~33
         53        ECHO                                                     ~34
         54      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.09 ms | 1392 KiB | 19 Q