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