What is Ternary Operator ?
t’s a shortcut for an if-else statement, and is also known as a conditional operator. Its operate on the three input
Ternary operators save time and lines of code. Its more preferable when you are performing simple conditional operation.
In PHP it works as:
In coldfusion it works as:
There is not any direct implementation of operator, but coldfusion uses function IIf for the same purpose
Without Ternary Operator
With Ternary Operator