FANDOM


Introduction Edit

The if keyword is used with or without the else keyword to control the flow of a script. The general form of the well known if-then-else construct is as follows:

if (expression) {
statement(s);
} else {
alternate statement(s);
}

Where the statement(s) are executed if the expression evaluates to a non-zero value.

Example:

if(0)
{
echo( "hello" );
}
else
{
echo ( "goodbye");
}

if(5)
{
echo( "hello" );
}
else
{
echo( "goodbye" );
}

If

See Also Edit

else