3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Asia/Singapore'); $emember_flag = 0; $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); if ($emember_flag == 1) { // if emember, then 3 months $sumstart_timestamp = $sumend_timestamp - 91; $strsum_startdate = date("Y-m-d", $sumstart_timestamp); } // $sumend_timestamp = $sumend_timestamp + $param_day_multiplier; // add 1 day to cover today $sumend_timestamp = $sumend_timestamp; // covers only until yesterday // die("debug start and end-date: ". $strsum_startdate ." ; ". $strsum_enddate); echo date('r', $sumstart_timestamp) . ' ' . date('r', $sumend_timestamp);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 44
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 55, Position 2 = 60
Branch analysis from position: 55
2 jumps found. (Code = 46) Position 1 = 64, Position 2 = 66
Branch analysis from position: 64
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 70
Branch analysis from position: 67
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 70
Branch analysis from position: 69
2 jumps found. (Code = 43) Position 1 = 81, Position 2 = 88
Branch analysis from position: 81
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 88
Branch analysis from position: 70
Branch analysis from position: 70
Branch analysis from position: 66
Branch analysis from position: 60
Branch analysis from position: 44
filename:       /in/HtG7b
function name:  (null)
number of ops:  101
compiled vars:  !0 = $emember_flag, !1 = $strsum_enddate, !2 = $sumend_timestamp, !3 = $tempstart_timestamp, !4 = $strtemp_date, !5 = $artemp, !6 = $startyear, !7 = $startmonth, !8 = $startday, !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                                                 
    3     3        ASSIGN                                                   !0, 0
    5     4        INIT_FCALL                                               'date'
          5        SEND_VAL                                                 'Y-m-d'
          6        DO_ICALL                                         $13     
          7        ASSIGN                                                   !1, $13
    6     8        INIT_FCALL                                               'strtotime'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $15     
         11        ASSIGN                                                   !2, $15
    7    12        INIT_FCALL                                               'strtotime'
         13        SEND_VAL                                                 '-1+day'
         14        DO_ICALL                                         $17     
         15        ASSIGN                                                   !3, $17
    8    16        INIT_FCALL                                               'date'
         17        SEND_VAL                                                 'Y-m-d'
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $19     
         20        ASSIGN                                                   !4, $19
   10    21        INIT_FCALL                                               'explode'
         22        SEND_VAL                                                 '-'
         23        SEND_VAR                                                 !4
         24        DO_ICALL                                         $21     
         25        ASSIGN                                                   !5, $21
   11    26        FETCH_DIM_R                                      ~23     !5, 0
         27        CAST                                          4  ~24     ~23
         28        SUB                                              ~25     ~24, 1
         29        ASSIGN                                                   !6, ~25
   12    30        FETCH_DIM_R                                      ~27     !5, 1
         31        ASSIGN                                                   !7, ~27
   13    32        INIT_FCALL                                               'substr'
         33        SEND_VAR                                                 !7
         34        SEND_VAL                                                 0
         35        SEND_VAL                                                 1
         36        DO_ICALL                                         $29     
         37        IS_EQUAL                                                 $29, '0'
         38      > JMPZ                                                     ~30, ->44
   14    39    >   INIT_FCALL                                               'substr'
         40        SEND_VAR                                                 !7
         41        SEND_VAL                                                 1
         42        DO_ICALL                                         $31     
         43        ASSIGN                                                   !7, $31
   16    44    >   CAST                                          4  ~33     !7
         45        ASSIGN                                                   !7, ~33
   17    46        FETCH_DIM_R                                      ~35     !5, 2
         47        ASSIGN                                                   !8, ~35
   18    48        INIT_FCALL                                               'substr'
         49        SEND_VAR                                                 !8
         50        SEND_VAL                                                 0
         51        SEND_VAL                                                 1
         52        DO_ICALL                                         $37     
         53        IS_EQUAL                                                 $37, '0'
         54      > JMPZ                                                     ~38, ->60
   19    55    >   INIT_FCALL                                               'substr'
         56        SEND_VAR                                                 !8
         57        SEND_VAL                                                 1
         58        DO_ICALL                                         $39     
         59        ASSIGN                                                   !8, $39
   21    60    >   CAST                                          4  ~41     !8
         61        ASSIGN                                                   !8, ~41
   22    62        IS_EQUAL                                         ~43     !7, 2
         63      > JMPZ_EX                                          ~43     ~43, ->66
         64    >   IS_EQUAL                                         ~44     !8, 29
         65        BOOL                                             ~43     ~44
         66    > > JMPZ                                                     ~43, ->70
   23    67    >   IS_EQUAL                                                 !0, 0
         68      > JMPZ                                                     ~45, ->70
   24    69    >   ASSIGN                                                   !8, 28
   27    70    >   CONCAT                                           ~47     !6, '-'
         71        CONCAT                                           ~48     ~47, !7
         72        CONCAT                                           ~49     ~48, '-'
         73        CONCAT                                           ~50     ~49, !8
         74        ASSIGN                                                   !9, ~50
   28    75        INIT_FCALL                                               'strtotime'
         76        SEND_VAR                                                 !9
         77        DO_ICALL                                         $52     
         78        ASSIGN                                                   !10, $52
   29    79        IS_EQUAL                                                 !0, 1
         80      > JMPZ                                                     ~54, ->88
   31    81    >   SUB                                              ~55     !2, 91
         82        ASSIGN                                                   !10, ~55
   32    83        INIT_FCALL                                               'date'
         84        SEND_VAL                                                 'Y-m-d'
         85        SEND_VAR                                                 !10
         86        DO_ICALL                                         $57     
         87        ASSIGN                                                   !9, $57
   35    88    >   ASSIGN                                                   !2, !2
   38    89        INIT_FCALL                                               'date'
         90        SEND_VAL                                                 'r'
         91        SEND_VAR                                                 !10
         92        DO_ICALL                                         $60     
         93        CONCAT                                           ~61     $60, '+'
         94        INIT_FCALL                                               'date'
         95        SEND_VAL                                                 'r'
         96        SEND_VAR                                                 !2
         97        DO_ICALL                                         $62     
         98        CONCAT                                           ~63     ~61, $62
         99        ECHO                                                     ~63
        100      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.39 ms | 1404 KiB | 23 Q