if inline php code example
Example 1: php inline if
/* most basic usage */
$var = 5;
$var_is_greater_than_two = ($var > 2 ? true : false); // returns true
Example 2: write if and else in one line php
$result = ($data->status == 1) ? 'active' : 'disable'
Example 3: inline php in html
<body>
Hello, today is <?php echo date('l, F jS, Y'); ?>.
</body>