if condition in php one line code example
Example 1: write if and else in one line php
$result = ($data->status == 1) ? 'active' : 'disable'
Example 2: one line if statement php
echo ($var1 >= $var2) ? 'this is true' : 'this is false';
$result = ($data->status == 1) ? 'active' : 'disable'
echo ($var1 >= $var2) ? 'this is true' : 'this is false';