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!

Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

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"

Sunday, September 18, 2011

PHP here document (also called a here-document, a heredoc, a hereis, here-string or here-script)

Using heredoc in PHP


<?php
echo <<<EOT

    <h1>This will display as an h1</h1>
    <p>I can use "double quotes"</p>
    <h1>and 'single quotes',
    <p>plus $variables too, which will
    be properly converted to their values,
    you can even type EOT.</p>

    <p>Make sure your opening EOT has no spaces after it,
    and the closing EOT has no spaces infront of it!</p>


 EOT;
 ?>

Delicious Digg Stumbleupon Favorites