Announcement
iPhone DZone: Fresh Links On Your iPhone by matt at Sat Jul 05 14:09:51 EDT 2008
Reading DZone on your iPhone just got a little bit easier. Visit http://dzone.com/iphone from your iPhone to try out our beta iPhone support. You can view stories, filter by tags, and login. We'd appreciate your feedback at feedback@dzone.com.
If you don't vote, who will? Login and vote now.
By harlan
via php.dzone.com
Published: Jan 23 2008 / 13:51
In looking at my Google Analytics statistics, I see a lot of visitors searching for PHP shorthand if/else (ternary) information. I've gone through my code library and picked out some examples of ternary operator usage.
Comments
antych replied ago:
If you are showing off shorthand, you should know that
$is_admin = ($user['permissions'] == 'admin' ? true : false);
is the same as
$is_admin = ($user['permissions'] == 'admin');
== operator already returns boolean value!
Voters For This Link (14)
Voters Against This Link (0)