3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Asia/Singapore'); $strvalidstart = '2014-01-22'; $strpointbal = '1640.0000'; /* this section for emember num days */ // $strvalidstart = "2012-03-01"; // debug $emember_numdays = 0; $param_day_multiplier = 24 * 60 * 60; $stremember_finaldate = ""; if ($strvalidstart != "") { $curr_timestamp = time(); $start_timestamp = strtotime($strvalidstart); if (floatval($strpointbal) <= 0) { // if no receipts / no points, start counting from current date $start_timestamp = $curr_timestamp; } $timediff = $curr_timestamp - $start_timestamp; // $end_timestamp = $start_timestamp + (90 * $param_day_multiplier); /* modified by ZY 13 Jul 2012, calc 3 months on the exact day */ $end_yy = intval(date("Y", $curr_timestamp)); $end_mm = intval(date("m", $curr_timestamp)); $end_dd = intval(date("d", $curr_timestamp)); if ($end_mm >= 10) { $end_yy++; $end_mm = $end_mm + 3 - 12; } else { $end_mm = $end_mm + 3; } $end_timestamp = strtotime($end_yy ."-". $end_mm ."-". $end_dd); $leapyear_flag = date("L", $end_timestamp); $totaldays_array = $this->array_totaldays_in_month(); $strkey = strval($end_mm); $month_totaldays = $totaldays_array[$strkey]; if ($end_mm == 2 && strval($leapyear_flag) == "1") { $month_totaldays = "29"; } $month_totaldays = intval($month_totaldays); if ($end_dd > $month_totaldays) { // if end-day is larger than total num of days in this month, set end-day to the last day of month $end_dd = $month_totaldays; } $end_timestamp = strtotime($end_yy ."-". $end_mm ."-". $end_dd); $emember_numdays = floor($timediff / $param_day_multiplier); if ($emember_numdays < 0) { $emember_numdays = 0; } else { $emember_numdays = 90 - $emember_numdays; if ($emember_numdays < 0) $emember_numdays = 0; } $stremember_finaldate = date("d-M-Y", $end_timestamp); } $strfinal_emember_numdays = $emember_numdays; // $strfinal_emember_numdays = $strvalidstart ." , ". $emember_numdays ." days"; // debug /* modified by ZY 6 Aug 2012, show - if no receipts */ if (floatval($strpointbal) <= 0) { // if no receipts / no points, change to dash $stremember_finaldate = "-"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 110
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 48
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
2 jumps found. (Code = 46) Position 1 = 73, Position 2 = 76
Branch analysis from position: 73
2 jumps found. (Code = 43) Position 1 = 77, Position 2 = 78
Branch analysis from position: 77
2 jumps found. (Code = 43) Position 1 = 82, Position 2 = 83
Branch analysis from position: 82
2 jumps found. (Code = 43) Position 1 = 98, Position 2 = 100
Branch analysis from position: 98
1 jumps found. (Code = 42) Position 1 = 105
Branch analysis from position: 105
2 jumps found. (Code = 43) Position 1 = 114, Position 2 = 115
Branch analysis from position: 114
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 115
Branch analysis from position: 100
2 jumps found. (Code = 43) Position 1 = 104, Position 2 = 105
Branch analysis from position: 104
2 jumps found. (Code = 43) Position 1 = 114, Position 2 = 115
Branch analysis from position: 114
Branch analysis from position: 115
Branch analysis from position: 105
Branch analysis from position: 83
Branch analysis from position: 78
Branch analysis from position: 76
Branch analysis from position: 48
2 jumps found. (Code = 46) Position 1 = 73, Position 2 = 76
Branch analysis from position: 73
Branch analysis from position: 76
Branch analysis from position: 21
Branch analysis from position: 110
filename:       /in/F5ZV0
function name:  (null)
number of ops:  116
compiled vars:  !0 = $strvalidstart, !1 = $strpointbal, !2 = $emember_numdays, !3 = $param_day_multiplier, !4 = $stremember_finaldate, !5 = $curr_timestamp, !6 = $start_timestamp, !7 = $timediff, !8 = $end_yy, !9 = $end_mm, !10 = $end_dd, !11 = $end_timestamp, !12 = $leapyear_flag, !13 = $totaldays_array, !14 = $strkey, !15 = $month_totaldays, !16 = $strfinal_emember_numdays
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        ASSIGN                                                   !0, '2014-01-22'
    5     4        ASSIGN                                                   !1, '1640.0000'
   10     5        ASSIGN                                                   !2, 0
   11     6        ASSIGN                                                   !3, 86400
   12     7        ASSIGN                                                   !4, ''
   13     8        IS_NOT_EQUAL                                             !0, ''
          9      > JMPZ                                                     ~23, ->110
   14    10    >   INIT_FCALL                                               'time'
         11        DO_ICALL                                         $24     
         12        ASSIGN                                                   !5, $24
   15    13        INIT_FCALL                                               'strtotime'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $26     
         16        ASSIGN                                                   !6, $26
   16    17        CAST                                          5  ~28     !1
         18        IS_SMALLER_OR_EQUAL                                      ~28, 0
         19      > JMPZ                                                     ~29, ->21
   18    20    >   ASSIGN                                                   !6, !5
   20    21    >   SUB                                              ~31     !5, !6
         22        ASSIGN                                                   !7, ~31
   24    23        INIT_FCALL                                               'date'
         24        SEND_VAL                                                 'Y'
         25        SEND_VAR                                                 !5
         26        DO_ICALL                                         $33     
         27        CAST                                          4  ~34     $33
         28        ASSIGN                                                   !8, ~34
   25    29        INIT_FCALL                                               'date'
         30        SEND_VAL                                                 'm'
         31        SEND_VAR                                                 !5
         32        DO_ICALL                                         $36     
         33        CAST                                          4  ~37     $36
         34        ASSIGN                                                   !9, ~37
   26    35        INIT_FCALL                                               'date'
         36        SEND_VAL                                                 'd'
         37        SEND_VAR                                                 !5
         38        DO_ICALL                                         $39     
         39        CAST                                          4  ~40     $39
         40        ASSIGN                                                   !10, ~40
   27    41        IS_SMALLER_OR_EQUAL                                      10, !9
         42      > JMPZ                                                     ~42, ->48
   28    43    >   PRE_INC                                                  !8
   29    44        ADD                                              ~44     !9, 3
         45        SUB                                              ~45     ~44, 12
         46        ASSIGN                                                   !9, ~45
         47      > JMP                                                      ->50
   31    48    >   ADD                                              ~47     !9, 3
         49        ASSIGN                                                   !9, ~47
   33    50    >   INIT_FCALL                                               'strtotime'
         51        CONCAT                                           ~49     !8, '-'
         52        CONCAT                                           ~50     ~49, !9
         53        CONCAT                                           ~51     ~50, '-'
         54        CONCAT                                           ~52     ~51, !10
         55        SEND_VAL                                                 ~52
         56        DO_ICALL                                         $53     
         57        ASSIGN                                                   !11, $53
   34    58        INIT_FCALL                                               'date'
         59        SEND_VAL                                                 'L'
         60        SEND_VAR                                                 !11
         61        DO_ICALL                                         $55     
         62        ASSIGN                                                   !12, $55
   35    63        FETCH_THIS                                       $57     
         64        INIT_METHOD_CALL                                         $57, 'array_totaldays_in_month'
         65        DO_FCALL                                      0  $58     
         66        ASSIGN                                                   !13, $58
   36    67        CAST                                          6  ~60     !9
         68        ASSIGN                                                   !14, ~60
   37    69        FETCH_DIM_R                                      ~62     !13, !14
         70        ASSIGN                                                   !15, ~62
   38    71        IS_EQUAL                                         ~64     !9, 2
         72      > JMPZ_EX                                          ~64     ~64, ->76
         73    >   CAST                                          6  ~65     !12
         74        IS_EQUAL                                         ~66     ~65, '1'
         75        BOOL                                             ~64     ~66
         76    > > JMPZ                                                     ~64, ->78
   39    77    >   ASSIGN                                                   !15, '29'
   41    78    >   CAST                                          4  ~68     !15
         79        ASSIGN                                                   !15, ~68
   42    80        IS_SMALLER                                               !15, !10
         81      > JMPZ                                                     ~70, ->83
   44    82    >   ASSIGN                                                   !10, !15
   46    83    >   INIT_FCALL                                               'strtotime'
         84        CONCAT                                           ~72     !8, '-'
         85        CONCAT                                           ~73     ~72, !9
         86        CONCAT                                           ~74     ~73, '-'
         87        CONCAT                                           ~75     ~74, !10
         88        SEND_VAL                                                 ~75
         89        DO_ICALL                                         $76     
         90        ASSIGN                                                   !11, $76
   48    91        INIT_FCALL                                               'floor'
         92        DIV                                              ~78     !7, !3
         93        SEND_VAL                                                 ~78
         94        DO_ICALL                                         $79     
         95        ASSIGN                                                   !2, $79
   49    96        IS_SMALLER                                               !2, 0
         97      > JMPZ                                                     ~81, ->100
   50    98    >   ASSIGN                                                   !2, 0
         99      > JMP                                                      ->105
   52   100    >   SUB                                              ~83     90, !2
        101        ASSIGN                                                   !2, ~83
   53   102        IS_SMALLER                                               !2, 0
        103      > JMPZ                                                     ~85, ->105
        104    >   ASSIGN                                                   !2, 0
   55   105    >   INIT_FCALL                                               'date'
        106        SEND_VAL                                                 'd-M-Y'
        107        SEND_VAR                                                 !11
        108        DO_ICALL                                         $87     
        109        ASSIGN                                                   !4, $87
   57   110    >   ASSIGN                                                   !16, !2
   61   111        CAST                                          5  ~90     !1
        112        IS_SMALLER_OR_EQUAL                                      ~90, 0
        113      > JMPZ                                                     ~91, ->115
   63   114    >   ASSIGN                                                   !4, '-'
   64   115    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.33 ms | 1404 KiB | 23 Q