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