Return to Snippet

Revision: 24955
at March 16, 2010 16:16 by cessnajumpin

Initial Code
$myFruit = $myFruit ? $myFruit : "apple";

Initial URL

Initial Description
Could be used across a multitude of languages. What this does is check to see if a variable is set, if it is then the variable gets left alone. If not, you define what it defaults to.

The example takes the variable $myFruit, and if it's already been defined it stays as that fruit. If not, then it is defined as the string "apple".

Initial Title
Simple Variable Handler

Initial Tags

Initial Language