jeudi 17 novembre 2016

Can I write "nested if" within "Else If" Condition in PHP

I need your help please help me.

I want to ask weather i can write if-else conditions like this code below

in other words : Can I write "nested if" within "Else If" Condition

if(!(preg_match($Regex_mob_no,$mob_no)))
    {
        echo "If Condition.";
    }

    else if(!(preg_match($Regex_cnic_no,$cnic_no)))
    {
        echo "Else If Condition.";
    }

    else if($select_reg_type = "as_a_company")
    {
        if($company_name == "")
        {
            echo "If Condition.";
        }

        else if(!(preg_match($Regex_company_name,$company_name)))
        {
            echo "Else If Condition.";
        }

        else
        {
            echo "Else Condition.";
        }
    }

    else if($Object > $name)
    {
        echo "Else If Condition.";
    }

    else
    {
        echo "Else Condition.";
    }
}
?>

Aucun commentaire:

Enregistrer un commentaire