Coalesce operation in PHP
Instead of writing IF statement it is possible to do the functionality that goes into IF statement inline.
Conditions are represented by two question marks. An operation that needs to be performed follows that. The result of this operation is assigned to a variable that precedes that whole operation.
Of course it will not work for complex functionality and it was not designed for it, but simple operations can be simplified even further.
Comments
Post a Comment