PHP: simple logic statement
I'm tired of searching for the correct syntax everytime I wan to use this line… if you're doing a simple one line "if" statement, you can use a "ternary conditional operator" - for example:
I'm tired of searching for the correct syntax everytime I wan to use this line… if you're doing a simple one line "if" statement, you can use a "ternary conditional operator" - for example:
November 5th, 2004 at 10:10 pm
Ah, the ternary operator. Just remember this. The question mark comes after the item in question — Is __ true ? Yes : No;
It's the only way I can remember it
November 6th, 2004 at 12:03 am
Don't you need parentheses around the condition? Or they optional in PHP?
November 20th, 2004 at 5:56 am