Example #1
0
 /**
  * Get zodiac sign from timestamp
  * @param   int
  * @return  string
  */
 public static function getLabelFromTimestamp($tstamp)
 {
     if ($tstamp == '') {
         return '';
     }
     $objSign = new ZodiacSign(DateTime::createFromFormat('U', $tstamp));
     return $objSign->getLabel();
 }
Example #2
0
     */
    private function gregorianToSexagenary($gYear)
    {
        return $gYear - 3 - 60 * floor(($gYear - 3) / 60);
    }
    /**
     * Now, we know that the Sexagenary cycle consists of 60 periods, thus, to determine what animal and element a certain year matches:
     *
     * @param
     * @return Response
     */
    public function generateAnimal($dateOfBirth)
    {
        $this->signs = $this->signs();
        $this->sexaCycle = $this->gregorianToSexagenary($dateOfBirth);
        $i = 1;
        while (ceil($this->sexaCycle / 12) > 0) {
            foreach ($this->signs as $animal => $value) {
                if ($i == $this->sexaCycle) {
                    return array($animal => $value);
                }
                $i++;
            }
        }
    }
}
$zodiac = new ZodiacSign();
$animal = $zodiac->generateAnimal(2026);
echo '<pre>';
print_r($animal);
echo '</pre>';