What is the best method / script to echo an image after sunset and before sunrise with php.
if (date("H:i") > date_sunset(time(), SUNFUNCS_RET_STRING, 51.29, 4.49, 90.7, 2)) { $icon = "icon_night"; } else { $icon = "icon_day"; } if (date("H:i") > date_sunrise(time(), SUNFUNCS_RET_STRING, 51.29, 4.49, 90.7, 2)) { $icon = "icon_night"; } else { $icon = "icon_day"; } echo $icon;
I wanted to return a day and night icon.