Inline if operation in PHP
It is possible to perform if operation inline. It is good for simple code only, if complex code uses this operation then the code will be difficult to understand.
First a comparison operation needs to happen, if the return value of this operation is true then the code that follows question mark symbol will be executed, if false then code that follows colon sign will be executed.
The result of these operations will be assigned to a variable that precedes this conditional statement.
Comments
Post a Comment