3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_weekday($date) { $week_day = date('w',$date); if ($week_day == 0) return strtotime("+1 day",$date); elseif ($week_day == 6) return strtotime("+2 day", $date); return time($date); } for($i = 1; $i < 10; $i++) { $today = strtotime("+$i days"); $quote_for = get_weekday($today); $diff = ceil(($quote_for - $today)/86400); // difference in days echo "On " . date('l \t\h\e jS',$today) . " the shipping quote will be for " . date('l \t\h\e jS', $quote_for) . " which is " . abs($diff) . " days " . ($diff <0?"before":"after") . " today. " . date('Y-m-d',$today) . " - " . date('Y-m-d',$quote_for) . "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 2
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 2
Branch analysis from position: 59
Branch analysis from position: 2
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 2
Branch analysis from position: 59
Branch analysis from position: 2
filename:       /in/G0hoD
function name:  (null)
number of ops:  60
compiled vars:  !0 = $i, !1 = $today, !2 = $quote_for, !3 = $diff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, 1
          1      > JMP                                                      ->57
   17     2    >   INIT_FCALL                                               'strtotime'
          3        ROPE_INIT                                     3  ~6      '%2B'
          4        ROPE_ADD                                      1  ~6      ~6, !0
          5        ROPE_END                                      2  ~5      ~6, '+days'
          6        SEND_VAL                                                 ~5
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !1, $8
   18     9        INIT_FCALL                                               'get_weekday'
         10        SEND_VAR                                                 !1
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !2, $10
   21    13        INIT_FCALL                                               'ceil'
         14        SUB                                              ~12     !2, !1
         15        DIV                                              ~13     ~12, 86400
         16        SEND_VAL                                                 ~13
         17        DO_ICALL                                         $14     
         18        ASSIGN                                                   !3, $14
   23    19        INIT_FCALL                                               'date'
         20        SEND_VAL                                                 'l+%5Ct%5Ch%5Ce+jS'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                         $16     
         23        CONCAT                                           ~17     'On+', $16
   24    24        CONCAT                                           ~18     ~17, '+the+shipping+quote+will+be+for++'
         25        INIT_FCALL                                               'date'
         26        SEND_VAL                                                 'l+%5Ct%5Ch%5Ce+jS'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                         $19     
         29        CONCAT                                           ~20     ~18, $19
   25    30        CONCAT                                           ~21     ~20, '+which+is+'
         31        INIT_FCALL                                               'abs'
         32        SEND_VAR                                                 !3
         33        DO_ICALL                                         $22     
         34        CONCAT                                           ~23     ~21, $22
         35        CONCAT                                           ~24     ~23, '+days+'
         36        IS_SMALLER                                               !3, 0
         37      > JMPZ                                                     ~25, ->40
         38    >   QM_ASSIGN                                        ~26     'before'
         39      > JMP                                                      ->41
         40    >   QM_ASSIGN                                        ~26     'after'
         41    >   CONCAT                                           ~27     ~24, ~26
         42        CONCAT                                           ~28     ~27, '+today.+'
   26    43        INIT_FCALL                                               'date'
         44        SEND_VAL                                                 'Y-m-d'
         45        SEND_VAR                                                 !1
         46        DO_ICALL                                         $29     
         47        CONCAT                                           ~30     ~28, $29
         48        CONCAT                                           ~31     ~30, '+-+'
         49        INIT_FCALL                                               'date'
         50        SEND_VAL                                                 'Y-m-d'
         51        SEND_VAR                                                 !2
         52        DO_ICALL                                         $32     
         53        CONCAT                                           ~33     ~31, $32
         54        CONCAT                                           ~34     ~33, '%0A'
         55        ECHO                                                     ~34
   15    56        PRE_INC                                                  !0
         57    >   IS_SMALLER                                               !0, 10
         58      > JMPNZ                                                    ~36, ->2
   28    59    > > RETURN                                                   1

Function get_weekday:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G0hoD
function name:  get_weekday
number of ops:  26
compiled vars:  !0 = $date, !1 = $week_day
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'date'
          2        SEND_VAL                                                 'w'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
    6     6        IS_EQUAL                                                 !1, 0
          7      > JMPZ                                                     ~4, ->14
    7     8    >   INIT_FCALL                                               'strtotime'
          9        SEND_VAL                                                 '%2B1+day'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $5      
         12      > RETURN                                                   $5
         13*       JMP                                                      ->21
    8    14    >   IS_EQUAL                                                 !1, 6
         15      > JMPZ                                                     ~6, ->21
    9    16    >   INIT_FCALL                                               'strtotime'
         17        SEND_VAL                                                 '%2B2+day'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $7      
         20      > RETURN                                                   $7
   11    21    >   INIT_FCALL                                               'time'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $8      
         24      > RETURN                                                   $8
   12    25*     > RETURN                                                   null

End of function get_weekday

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.78 ms | 1407 KiB | 24 Q