Menu
In JavaScript, when I’m not sure if a variable is defined, I can say
[CODE]alert(myVar || “Something else”)
If the variable is undefined, it will obviously return “Something else”.
In PHP, I have been using isset() and the ternary operator (??
[code=php]echo isset($myVar) ? myVar : ‘Something else’;
This seems kind of redundant, and I was hoping there was something similar in PHP.