Is there a way to have an inline if statement in PHP which also includes a elseif?
I would assume the logic would go something like this:
$unparsedCalculation = ($calculation > 0) ? "<span style=\"color: #9FE076;\">".$calculation : ($calculation < 0) ? "<span style=\"color: #FF736A;\">".$calculation : $calculation;
elseifis nothing more thanelse if, so, practically, there is noelseif, it’s just a convenience. The same convenience is not provided for the ternary operator, because the ternary operator is meant to be used for very short logic.is identical to
Therefore, the ternary equivalent is