romanitalian
12/8/2017 - 6:58 PM

"Happy Birthday, Alexander!" at 2017-12-08 10am

"Happy Birthday, Alexander!" at 2017-12-08 10am

<?php
/*
 * "Happy Birthday, Alexander!"
 *
 * $Hb = new Hb;
 * $Hb->main();
 */
class Hb
{
    protected $HbText = "01001000 01100001 01110000 01110000 01111001 00100000 01000010 01101001 01110010 01110100 01101000 01100100 01100001 01111001 00101100 00100000 01000001 01101100 01100101 01111000 01100001 01101110 01100100 01100101 01110010 00100001";
    protected $HbTextDefault = "01000111 01110010 01100101 01100001 01110100 00100000 01000100 01100001 01111001 00100001";
    protected $HbDate = "2017-12-08";
    
    public function getHbText()
    {
        return $this->HbText;
    }
    public function getHbTextDefault()
    {
        return $this->HbTextDefault;
    }
    
    protected function getTodayText() {
        return date("Y-m-d") == $this->HbDate 
            ? $this->getHbText()
            : $this->getHbTextDefault();
    }
    
    public static function main() {
        $it = new static;
        while (1) {
            // Congratulate at 10am
            if (date("H") == "10") {
                echo $it->getTodayText();
            }
            sleep(3600);
        }
    }
}