3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Asia/Singapore'); $strvalidstart = '2014-01-22'; $strpointbal = '1640.0000'; function array_totaldays_in_month() { $totaldays_array = array("1"=>"", "2"=>"28", "3"=>"31", "4"=>"30", "5"=>"31", "6"=>"30", "7"=>"31", "8"=>"31", "9"=>"30", "10"=>"31", "11"=>"30", "12"=>"31"); return $totaldays_array; } /* 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 = 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 = 109
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 = 72, Position 2 = 75
Branch analysis from position: 72
2 jumps found. (Code = 43) Position 1 = 76, Position 2 = 77
Branch analysis from position: 76
2 jumps found. (Code = 43) Position 1 = 81, Position 2 = 82
Branch analysis from position: 81
2 jumps found. (Code = 43) Position 1 = 97, Position 2 = 99
Branch analysis from position: 97
1 jumps found. (Code = 42) Position 1 = 104
Branch analysis from position: 104
2 jumps found. (Code = 43) Position 1 = 113, Position 2 = 114
Branch analysis from position: 113
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 114
Branch analysis from position: 99
2 jumps found. (Code = 43) Position 1 = 103, Position 2 = 104
Branch analysis from position: 103
2 jumps found. (Code = 43) Position 1 = 113, Position 2 = 114
Branch analysis from position: 113
Branch analysis from position: 114
Branch analysis from position: 104
Branch analysis from position: 82
Branch analysis from position: 77
Branch analysis from position: 75
Branch analysis from position: 48
2 jumps found. (Code = 46) Position 1 = 72, Position 2 = 75
Branch analysis from position: 72
Branch analysis from position: 75
Branch analysis from position: 21
Branch analysis from position: 109
filename:       /in/vYKWu
function name:  (null)
number of ops:  115
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'
   15     5        ASSIGN                                                   !2, 0
   16     6        ASSIGN                                                   !3, 86400
   17     7        ASSIGN                                                   !4, ''
   18     8        IS_NOT_EQUAL                                             !0, ''
          9      > JMPZ                                                     ~23, ->109
   19    10    >   INIT_FCALL                                               'time'
         11        DO_ICALL                                         $24     
         12        ASSIGN                                                   !5, $24
   20    13        INIT_FCALL                                               'strtotime'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $26     
         16        ASSIGN                                                   !6, $26
   21    17        CAST                                          5  ~28     !1
         18        IS_SMALLER_OR_EQUAL                                      ~28, 0
         19      > JMPZ                                                     ~29, ->21
   23    20    >   ASSIGN                                                   !6, !5
   25    21    >   SUB                                              ~31     !5, !6
         22        ASSIGN                                                   !7, ~31
   29    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
   30    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
   31    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
   32    41        IS_SMALLER_OR_EQUAL                                      10, !9
         42      > JMPZ                                                     ~42, ->48
   33    43    >   PRE_INC                                                  !8
   34    44        ADD                                              ~44     !9, 3
         45        SUB                                              ~45     ~44, 12
         46        ASSIGN                                                   !9, ~45
         47      > JMP                                                      ->50
   36    48    >   ADD                                              ~47     !9, 3
         49        ASSIGN                                                   !9, ~47
   38    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
   39    58        INIT_FCALL                                               'date'
         59        SEND_VAL                                                 'L'
         60        SEND_VAR                                                 !11
         61        DO_ICALL                                         $55     
         62        ASSIGN                                                   !12, $55
   40    63        INIT_FCALL                                               'array_totaldays_in_month'
         64        DO_FCALL                                      0  $57     
         65        ASSIGN                                                   !13, $57
   41    66        CAST                                          6  ~59     !9
         67        ASSIGN                                                   !14, ~59
   42    68        FETCH_DIM_R                                      ~61     !13, !14
         69        ASSIGN                                                   !15, ~61
   43    70        IS_EQUAL                                         ~63     !9, 2
         71      > JMPZ_EX                                          ~63     ~63, ->75
         72    >   CAST                                          6  ~64     !12
         73        IS_EQUAL                                         ~65     ~64, '1'
         74        BOOL                                             ~63     ~65
         75    > > JMPZ                                                     ~63, ->77
   44    76    >   ASSIGN                                                   !15, '29'
   46    77    >   CAST                                          4  ~67     !15
         78        ASSIGN                                                   !15, ~67
   47    79        IS_SMALLER                                               !15, !10
         80      > JMPZ                                                     ~69, ->82
   49    81    >   ASSIGN                                                   !10, !15
   51    82    >   INIT_FCALL                                               'strtotime'
         83        CONCAT                                           ~71     !8, '-'
         84        CONCAT                                           ~72     ~71, !9
         85        CONCAT                                           ~73     ~72, '-'
         86        CONCAT                                           ~74     ~73, !10
         87        SEND_VAL                                                 ~74
         88        DO_ICALL                                         $75     
         89        ASSIGN                                                   !11, $75
   53    90        INIT_FCALL                                               'floor'
         91        DIV                                              ~77     !7, !3
         92        SEND_VAL                                                 ~77
         93        DO_ICALL                                         $78     
         94        ASSIGN                                                   !2, $78
   54    95        IS_SMALLER                                               !2, 0
         96      > JMPZ                                                     ~80, ->99
   55    97    >   ASSIGN                                                   !2, 0
         98      > JMP                                                      ->104
   57    99    >   SUB                                              ~82     90, !2
        100        ASSIGN                                                   !2, ~82
   58   101        IS_SMALLER                                               !2, 0
        102      > JMPZ                                                     ~84, ->104
        103    >   ASSIGN                                                   !2, 0
   60   104    >   INIT_FCALL                                               'date'
        105        SEND_VAL                                                 'd-M-Y'
        106        SEND_VAR                                                 !11
        107        DO_ICALL                                         $86     
        108        ASSIGN                                                   !4, $86
   62   109    >   ASSIGN                                                   !16, !2
   66   110        CAST                                          5  ~89     !1
        111        IS_SMALLER_OR_EQUAL                                      ~89, 0
        112      > JMPZ                                                     ~90, ->114
   68   113    >   ASSIGN                                                   !4, '-'
   69   114    > > RETURN                                                   1

Function array_totaldays_in_month:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vYKWu
function name:  array_totaldays_in_month
number of ops:  3
compiled vars:  !0 = $totaldays_array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, <array>
   10     1      > RETURN                                                   !0
   11     2*     > RETURN                                                   null

End of function array_totaldays_in_month

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.59 ms | 1402 KiB | 24 Q