date_sun* PHP Functions

By Deane Barker on January 26, 2005

PHP: date_sunrise – Manual: I don’t know how closely you all are looking at the PHP 5 function libraries, but I stumbled on this function today (and its sibling).

date_sunset() returns the sunset time for a given day (specified as a timestamp) and location. The latitude, longitude and zenith parameters default to the date.default_latitude, date.default_longitude and date.sunset_zenith configuration options, respectively.

The latitude defaults to North. So, if you want to specify a South value, you must pass a negative value. The same note applies to longitude, which defaults to East.

I love PHP, but I really wonder about things like this. We’ve talked before about some problems with the language (especially compared to Perl), like inconsistent function naming, and — as this function perhaps demonstrates — having too many functions in the core.

Isn’t this something that PEAR could have handled? Does this need to be built into the core? What percentage of PHP programmers have a need for this?



  1. I agree — for ME this is really cool, but if you’re going to have sunrise and sunset functions built into the language, how many million other things will there be?

Comments are closed. If you have something you really want to say, tweet @gadgetopia.