3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Asia/Singapore'); $strsum_enddate = date("Y-m-d"); $sumend_timestamp = strtotime($strsum_enddate); $tempstart_timestamp = strtotime("-1 day"); $strtemp_date = date("Y-m-d", $tempstart_timestamp); // $artemp = explode("-", $strsum_enddate); $artemp = explode("-", $strtemp_date); $startyear = intval($artemp[0]) - 1; // derive start-date from end-date $startmonth = $artemp[1]; if (substr($startmonth, 0, 1) == "0") { $startmonth = substr($startmonth, 1); } $startmonth = intval($startmonth); $startday = $artemp[2]; if (substr($startday, 0, 1) == "0") { $startday = substr($startday, 1); } $startday = intval($startday); if ($startmonth == 2 && $startday == 29) { // if feb 29, set to feb 28, 2 years is not a leap year if ($emember_flag == 0) { // if not emember, go back 1 year $startday = 28; } } $strsum_startdate = $startyear ."-". $startmonth ."-". $startday; $sumstart_timestamp = strtotime($strsum_startdate); echo date('Y-m-d', $sumstart_timestamp) . "\n"; echo date('Y-m-d', $sumend_timestamp) . "\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 43
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 59
Branch analysis from position: 54
2 jumps found. (Code = 46) Position 1 = 63, Position 2 = 65
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 69
Branch analysis from position: 66
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 69
Branch analysis from position: 68
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 69
Branch analysis from position: 69
Branch analysis from position: 65
Branch analysis from position: 59
Branch analysis from position: 43
filename:       /in/ZbMRO
function name:  (null)
number of ops:  91
compiled vars:  !0 = $strsum_enddate, !1 = $sumend_timestamp, !2 = $tempstart_timestamp, !3 = $strtemp_date, !4 = $artemp, !5 = $startyear, !6 = $startmonth, !7 = $startday, !8 = $emember_flag, !9 = $strsum_startdate, !10 = $sumstart_timestamp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'Asia%2FSingapore'
          2        DO_ICALL                                                 
    4     3        INIT_FCALL                                               'date'
          4        SEND_VAL                                                 'Y-m-d'
          5        DO_ICALL                                         $12     
          6        ASSIGN                                                   !0, $12
    5     7        INIT_FCALL                                               'strtotime'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $14     
         10        ASSIGN                                                   !1, $14
    6    11        INIT_FCALL                                               'strtotime'
         12        SEND_VAL                                                 '-1+day'
         13        DO_ICALL                                         $16     
         14        ASSIGN                                                   !2, $16
    7    15        INIT_FCALL                                               'date'
         16        SEND_VAL                                                 'Y-m-d'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                         $18     
         19        ASSIGN                                                   !3, $18
    9    20        INIT_FCALL                                               'explode'
         21        SEND_VAL                                                 '-'
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                         $20     
         24        ASSIGN                                                   !4, $20
   10    25        FETCH_DIM_R                                      ~22     !4, 0
         26        CAST                                          4  ~23     ~22
         27        SUB                                              ~24     ~23, 1
         28        ASSIGN                                                   !5, ~24
   11    29        FETCH_DIM_R                                      ~26     !4, 1
         30        ASSIGN                                                   !6, ~26
   12    31        INIT_FCALL                                               'substr'
         32        SEND_VAR                                                 !6
         33        SEND_VAL                                                 0
         34        SEND_VAL                                                 1
         35        DO_ICALL                                         $28     
         36        IS_EQUAL                                                 $28, '0'
         37      > JMPZ                                                     ~29, ->43
   13    38    >   INIT_FCALL                                               'substr'
         39        SEND_VAR                                                 !6
         40        SEND_VAL                                                 1
         41        DO_ICALL                                         $30     
         42        ASSIGN                                                   !6, $30
   15    43    >   CAST                                          4  ~32     !6
         44        ASSIGN                                                   !6, ~32
   16    45        FETCH_DIM_R                                      ~34     !4, 2
         46        ASSIGN                                                   !7, ~34
   17    47        INIT_FCALL                                               'substr'
         48        SEND_VAR                                                 !7
         49        SEND_VAL                                                 0
         50        SEND_VAL                                                 1
         51        DO_ICALL                                         $36     
         52        IS_EQUAL                                                 $36, '0'
         53      > JMPZ                                                     ~37, ->59
   18    54    >   INIT_FCALL                                               'substr'
         55        SEND_VAR                                                 !7
         56        SEND_VAL                                                 1
         57        DO_ICALL                                         $38     
         58        ASSIGN                                                   !7, $38
   20    59    >   CAST                                          4  ~40     !7
         60        ASSIGN                                                   !7, ~40
   21    61        IS_EQUAL                                         ~42     !6, 2
         62      > JMPZ_EX                                          ~42     ~42, ->65
         63    >   IS_EQUAL                                         ~43     !7, 29
         64        BOOL                                             ~42     ~43
         65    > > JMPZ                                                     ~42, ->69
   22    66    >   IS_EQUAL                                                 !8, 0
         67      > JMPZ                                                     ~44, ->69
   23    68    >   ASSIGN                                                   !7, 28
   26    69    >   CONCAT                                           ~46     !5, '-'
         70        CONCAT                                           ~47     ~46, !6
         71        CONCAT                                           ~48     ~47, '-'
         72        CONCAT                                           ~49     ~48, !7
         73        ASSIGN                                                   !9, ~49
   27    74        INIT_FCALL                                               'strtotime'
         75        SEND_VAR                                                 !9
         76        DO_ICALL                                         $51     
         77        ASSIGN                                                   !10, $51
   29    78        INIT_FCALL                                               'date'
         79        SEND_VAL                                                 'Y-m-d'
         80        SEND_VAR                                                 !10
         81        DO_ICALL                                         $53     
         82        CONCAT                                           ~54     $53, '%0A'
         83        ECHO                                                     ~54
   30    84        INIT_FCALL                                               'date'
         85        SEND_VAL                                                 'Y-m-d'
         86        SEND_VAR                                                 !1
         87        DO_ICALL                                         $55     
         88        CONCAT                                           ~56     $55, '%0A'
         89        ECHO                                                     ~56
         90      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.22 ms | 1404 KiB | 23 Q