What does the following do?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Crux
Forum Newbie
Posts: 7
Joined: Sat Jan 08, 2011 7:01 am

What does the following do?

Post by Crux »

When used like in the example what does a "If" do?

Code: Select all

if($name)
{
// write here what to do;
}
TorMike
Forum Newbie
Posts: 17
Joined: Thu Feb 25, 2010 9:14 am

Re: What does the following do?

Post 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.
Post Reply