In JavaScript, when I'm not sure if a variable is defined, I can sayIf the variable is undefined, it will obviously return "Something else".Code:alert(myVar || "Something else")
In PHP, I have been using isset() and the ternary operator (?This seems kind of redundant, and I was hoping there was something similar in PHP.PHP Code:echo isset($myVar) ? myVar : 'Something else';



Reply With Quote

Bookmarks