Featured Website - Planescape Online

The Planescape Online website has been a labor of love. Since the beginning of my time at Conestoga College, in the Web Design and Development program, I have been working very hard on this personal project.

Preloading Images and Removing Screen Flicker While SWF Loads

Give your website look smoother by preloading images and making SWF content load without distracting flickering.

PHP here document (heredoc)

How to use heredoc in PHP.

Web Design and Development Course List

The full course list for the Web Design and Development program at Conestoga College. I will be graduating in January!

Tuesday, November 8, 2011

PHP: Ternary Operator, Short 'if' Statement, One Line 'if' Statement

The ternary operator is called so because it takes three operands; a condition, a result for true, and a result for false.

The ternary operator is a shorthand way of writing if statements.

Here's an example:

//Assign a string value to $x
$x = ($myvalue == 10) ? "the value is 10": "the value is not 10";

Breaking it down into its three parts you get this:
Condition: ($myvalue == 10)
Result for true: $x = "the value is 10"
Result for false: $x = "the value is not 10"

Delicious Digg Stumbleupon Favorites