Apps  Contact  Seminars 

Archive for February, 2009


February 17th, 2009

Short cut if statement in PHP

by Amrinder

Surprisingly, I still come across quite a few “long cut if statements” of the following form:

if ($var1 == $var2) echo ” selected”;

It is of course much easier to say, and much easier to read:
echo ($var1 == $var2 ? ” selected” : “”);

Tags:


Switch to our mobile site