How to replace “if” statement with a ternary operator ( ? : )?
The syntax is not a “shorthand if” operator (the ? is called the conditional operator) because you cannot execute code in the same manner as if you did: In your example, you are executing the echo statement when the $address is not empty. You can’t do this the same way with the conditional operator. What you can do however, is echo the result … Read more