Jump to content

ProgramaTic

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by ProgramaTic

  1. Hi,

    I'm making a code for determining the astrological sign of anyone.
    The code receives a date in this format "YYYY-MM-DD" and strips that string in year, month and day.

    So I've wrotten this function:

        //determinar signo
        public function Determinar(){
            switch ($this->month){
                case 01:
                    if ($this->day <= 19){
                        $this->signo = "Capricornio";
                    } else {
                        $this->signo = "Acuario";
                    }
                break;
                case 02:
                    if ($this->day <= 18){
                        $this->signo = "Acuario";
                    } else {
                        $this->signo = "Piscis";
                    }
                break;
                case 03:
                    if ($this->day <= 20){
                        $this->signo = "Piscis";
                    } else {
                        $this->signo = "Aries";
                    }
                break;
                case 04:
                    if ($this->day <= 20){
                        $this->signo = "Aries";
                    } else {
                        $this->signo = "Tauro";
                    }
                break;
                case 05:
                    if ($this->day <= 20){
                        $this->signo = "Tauro";
                    } else {
                        $this->signo = "Geminis";
                    }
                break;
                case 06:
                    if ($this->day <= 20){
                        $this->signo = "Geminis";
                    } else {
                        $this->signo = "Cancer";
                    }
                break;
                case 07:
                    if ($this->day <= 20){
                        $this->signo = "Cancer";
                    } else {
                        $this->signo = "Leo";
                    }
                break;
                case 08:
                    if ($this->day <= 21){
                        $this->signo = "Leo";
                    } else {
                        $this->signo = "Virgo";
                    }
                break;
                case 09:
                    if ($this->day <= 22){
                        $this->signo = "Virgo";
                    } else {
                        $this->signo = "Libra";
                    }
                break;
                case 10:
                    if ($this->day <= 22){
                        $this->signo = "Libra";
                    } else {
                        $this->signo = "Escorpio";
                    }
                break;
                case 11:
                    if ($this->day <= 22){
                        $this->signo = "Escorpio";
                    } else {
                        $this->signo = "Sagitario";
                    }
                break;
                case 12:
                    if ($this->day <= 20){
                        $this->signo = "Sagitario";
                    } else {
                        $this->signo = "Capricornio";
                    }
                break;
            }
        }
    

    In this switch, cases 01 to 07 and 10 to 12 are working correctly.
    But cases 08 and 09 doesn't works.

    I can't find the problem/error, syntax seems to be correct bemused.gif

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.