/ Published in: PHP

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".
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".
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$myFruit = $myFruit ? $myFruit : "apple";
Comments
