PHP: 10 things you may not know

I stumbled across a great post (and a great blog if you are also a developer) recently. The post is called 10 things you (probably) didn’t know about PHP., and i’m not too shy to admit that, yes, I didn’t!.

Of particular interest is the reference to the Ternary Operator. Put simply if you are using an “IF” loop, and only testing two conditions, instead of using:

“if (condition1 == “set”)
{
$variable = 1
}
else
{
$variable = 2
}

you can use:

$variable = (condition1 == “set”) ? 1 : 2;

0 Responses to “PHP: 10 things you may not know”

  1. No Comments

Leave a Reply

Valid XHTML 1.0 Transitional