OK...
This is another easy question that everyone has an answer for.
Here's mine
:D

the if statement has many ways of being formed.
1 line code: (Echo or exit command)

if(empty($Variable))
    exit;
else
    echo "Variable exists

Multiple line code:
if(empty($Variable))
{
    header("Location: Here.com");
    exit;
}
else
{
    echo "Valid variable";
    eixt;
}

Combined:
if(empty($Variable))
    echo "Variable empty";
else
{
    Header("Location: Here.com");
    exit;
}

or the other alternative

(empty($Variable)) ? echo "Empty" : echo "Contains Something";

<[EMAIL PROTECTED]> wrote in message
news:OFF48BDDD0.BCC82414-ON87256BF2.004F65C2-87256BF2.004F6811@blackhillscor
p.com...
> This will only work if you have a single line of code after the else and
> if.  At least that is my understanding of all languages :)
>
> J
>
>
>
>
>
> "Alexander Ross" <[EMAIL PROTECTED]>
> 07/10/2002 08:25 AM
>
>
>         To:     [EMAIL PROTECTED]
>         cc:
>         Subject:        [PHP] if syntax
>
>
> I know this is correct:
>
> if ($something)
> {
> ...
> }
> else
> {
> ...
> }
>
> But I recently saw someone use this instead:
>
> if($something):
>  ...
> else:
> ...
>
> Is that also correct??   No brackets needed?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to