3v4l.org

run code in 300+ PHP versions simultaneously
<?php function solstice() { // Set timezone date_default_timezone_set('UTC'); $date='2014/01/01'; $end_date='2014/12/31'; $i = 0; //loop through the year while(strtotime($date)<=strtotime($end_date)) { $sunrise=date_sunrise(strtotime($date),SUNFUNCS_RET_DOUBLE,31.47,35.13,90,3); $sunset=date_sunset(strtotime($date),SUNFUNCS_RET_DOUBLE,31.47,35.13,90,3); //calculate time difference $delta = $sunset-$sunrise; //store the time difference $delta_array[$i] = $delta; //store the date $dates_array[$i] = $date; $i++; //next day $date=date("Y-m-d",strtotime("+1 day",strtotime($date))); } $shortest_key = array_search(min($delta_array), $delta_array); $longest_key = array_search(max($delta_array), $delta_array); echo "The longest day is:".$dates_array[$longest_key]. "<br />"; echo "The shortest day is:".$dates_array[$shortest_key]. "<br />"; } solstice();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QncE9
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   INIT_FCALL                                               'solstice'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Function solstice:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 7
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 7
Branch analysis from position: 58
Branch analysis from position: 7
filename:       /in/QncE9
function name:  solstice
number of ops:  83
compiled vars:  !0 = $date, !1 = $end_date, !2 = $i, !3 = $sunrise, !4 = $sunset, !5 = $delta, !6 = $delta_array, !7 = $dates_array, !8 = $shortest_key, !9 = $longest_key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'UTC'
          2        DO_ICALL                                                 
    6     3        ASSIGN                                                   !0, '2014%2F01%2F01'
    8     4        ASSIGN                                                   !1, '2014%2F12%2F31'
    9     5        ASSIGN                                                   !2, 0
   11     6      > JMP                                                      ->50
   12     7    >   INIT_FCALL                                               'date_sunrise'
          8        INIT_FCALL                                               'strtotime'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $14     
         11        SEND_VAR                                                 $14
         12        SEND_VAL                                                 2
         13        SEND_VAL                                                 31.47
         14        SEND_VAL                                                 35.13
         15        SEND_VAL                                                 90
         16        SEND_VAL                                                 3
         17        DO_ICALL                                         $15     
         18        ASSIGN                                                   !3, $15
   13    19        INIT_FCALL                                               'date_sunset'
         20        INIT_FCALL                                               'strtotime'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $17     
         23        SEND_VAR                                                 $17
         24        SEND_VAL                                                 2
         25        SEND_VAL                                                 31.47
         26        SEND_VAL                                                 35.13
         27        SEND_VAL                                                 90
         28        SEND_VAL                                                 3
         29        DO_ICALL                                         $18     
         30        ASSIGN                                                   !4, $18
   15    31        SUB                                              ~20     !4, !3
         32        ASSIGN                                                   !5, ~20
   17    33        ASSIGN_DIM                                               !6, !2
         34        OP_DATA                                                  !5
   19    35        ASSIGN_DIM                                               !7, !2
         36        OP_DATA                                                  !0
   20    37        PRE_INC                                                  !2
   22    38        INIT_FCALL                                               'date'
         39        SEND_VAL                                                 'Y-m-d'
         40        INIT_FCALL                                               'strtotime'
         41        SEND_VAL                                                 '%2B1+day'
         42        INIT_FCALL                                               'strtotime'
         43        SEND_VAR                                                 !0
         44        DO_ICALL                                         $25     
         45        SEND_VAR                                                 $25
         46        DO_ICALL                                         $26     
         47        SEND_VAR                                                 $26
         48        DO_ICALL                                         $27     
         49        ASSIGN                                                   !0, $27
   11    50    >   INIT_FCALL                                               'strtotime'
         51        SEND_VAR                                                 !0
         52        DO_ICALL                                         $29     
         53        INIT_FCALL                                               'strtotime'
         54        SEND_VAR                                                 !1
         55        DO_ICALL                                         $30     
         56        IS_SMALLER_OR_EQUAL                                      $29, $30
         57      > JMPNZ                                                    ~31, ->7
   25    58    >   INIT_FCALL                                               'array_search'
         59        INIT_FCALL                                               'min'
         60        SEND_VAR                                                 !6
         61        DO_ICALL                                         $32     
         62        SEND_VAR                                                 $32
         63        SEND_VAR                                                 !6
         64        DO_ICALL                                         $33     
         65        ASSIGN                                                   !8, $33
   26    66        INIT_FCALL                                               'array_search'
         67        INIT_FCALL                                               'max'
         68        SEND_VAR                                                 !6
         69        DO_ICALL                                         $35     
         70        SEND_VAR                                                 $35
         71        SEND_VAR                                                 !6
         72        DO_ICALL                                         $36     
         73        ASSIGN                                                   !9, $36
   28    74        FETCH_DIM_R                                      ~38     !7, !9
         75        CONCAT                                           ~39     'The+longest+day+is%3A', ~38
         76        CONCAT                                           ~40     ~39, '%3Cbr+%2F%3E'
         77        ECHO                                                     ~40
   29    78        FETCH_DIM_R                                      ~41     !7, !8
         79        CONCAT                                           ~42     'The+shortest+day+is%3A', ~41
         80        CONCAT                                           ~43     ~42, '%3Cbr+%2F%3E'
         81        ECHO                                                     ~43
   30    82      > RETURN                                                   null

End of function solstice

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.59 ms | 1407 KiB | 30 Q