Quantcast
Channel: PHPDeveloper.org
Viewing all articles
Browse latest Browse all 1515

NetTuts.com: The Ternary Operator in PHP

$
0
0

If you're relatively new to the PHP language, there's an interesting "shorthand" method for evaluation that you may not know about. In this new tutorial from NetTuts.com they show you this handy method - the ternary operator.

The ternary operator allows us to simplify some PHP conditional statements. We'll see how it can be used, with test-driven development and refactoring, to simplify code.

While the tutorial is largely a screencast, they do provide a quick summary of what the operator is mainly used for and an example for quick reference.

Link: http://code.tutsplus.com/tutorials/the-ternary-operator-in-php--cms-24010

Viewing all articles
Browse latest Browse all 1515

Trending Articles