php if else 1 line code example
Example 1: write if and else in one line php
$result = ($data->status == 1) ? 'active' : 'disable'
Example 2: php one line if without else
$thisVar != $thatVar ?: doThis();
or
($thisVar == $thatVar) && doThis();
or
if ($thisVar == $thatVar) doThis();