«« Next » « Previous
«« Next » « Previous

Link Details

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.

Your votes power DZone. Login and vote now.
Link 57648 thumbnail

By davidwalsh
via davidwalsh.name
Published: Dec 18 2007 / 10:13

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.
  • 12
  • 1
  • 1981
  • 569

Comments

Add your comment
User 261350 avatar

harlan replied ago:

0 votes Vote down Vote up Reply

Nice post dwizzle

User 256617 avatar

dragmire replied ago:

0 votes Vote down Vote up Reply

Ternary ifs are difficult to read. Avoid unless you can somehow make it easier.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (12)



Voters Against This Link (1)