Calculate Moon Phase Data with PHP III

Yet another awesome update to the PHP-based moon phase script, which was a translation of the Perl Astro::MoonPhase module. This module is designed to calculate the phase of the moon for a particular date or set of dates, and is very accurate - and also pretty awesome, did I mention that?

Christopher Hopper was kind enough to work the code into a PHP class, with doxygen-style comments and everything! The class as well as an example script is included in the archive linked below. A big thanks to Christopher for doing all this work. Enjoy!

PHP Class and Example Script -->


PuMi said...

In Astro_MoonPhase.php
code - "require_once 'PEAR.php';" ??

Newton Pasqualini said...

Hi there,

I try to get the moon phase using this script and it is saying 4% Illuminated when it is 1%.

The question is, the lat/lng and the timezone will make some mistakes like that???

What should I do, I live in Sao Paulo, Brazil, my timezone is UTC -3 there is needed some adjusts into the constants?

Рафаэль М said...

Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in \Astro_MoonPhase.php on line 56.
No file pear.php?

Ton Strik said...

Not needed. Comment out line 56 in Astro_MoonPhase.php and change line 94 "class Astro_MoonPhase extends PEAR {" in "class Astro_MoonPhase {