PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Marco Palmieri   Moon   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: usage example
Class: Moon
Calculate the phase of the Moon for a given date
Author: By
Last change: new methods
Date: 14 years ago
Size: 570 bytes
 

Contents

Class file image Download
<?php

   
include "moon.php";
   
$moon = new moon();

    if (
$moon->set("date", date("Y-m-d"))) {

       
$phase_name = $moon->get_phase_name();
       
$phase_at = $moon->get_phase_percent();
       
$visibility = $moon->get_visibility();
       
$next_newmoon = $moon->get_next_newmoon();
       
$next_fullmoon = $moon->get_next_fullmoon();

        echo <<<MOON_INFO
phase name: {$phase_name}
phase percentage:
{$phase_at}%
visibility:
{$visibility}%
next new moon:
{$next_newmoon}
next full moon:
{$next_fullmoon}
MOON_INFO;
  
    }

?>