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