Page 1 of 1

What does the following do?

Posted: Mon Jan 10, 2011 11:22 am
by Crux
When used like in the example what does a "If" do?

Code: Select all

if($name)
{
// write here what to do;
}

Re: What does the following do?

Posted: Mon Jan 10, 2011 12:38 pm
by TorMike
An 'if' statement will evaluate the value of the variable $name. If True execute between { }, if false, next line. Usually an 'if' will execute if the variable evaluates TRUE.

Without knowing what type of variable $name is: boolean, number, alphanumeric, it impossible to know what it will do.