single line conditional statement in php code example Example: write if and else in one line php $result = ($data->status == 1) ? 'active' : 'disable'