[Solved] Two variables if empty else other [closed]


<?php echo (empty($LOGO) ? $TITLE : $LOGO) ?>

will show $TITLE if $LOGO is empty. Otherwise will only show $LOGO.

This operator is called the ternary operator.

empty works like this:

The following things are considered to be empty:

- "" (an empty string)
- 0 (0 as an integer)
- 0.0 (0 as a float)
- "0" (0 as a string)
- NULL
- FALSE
- array() (an empty array)
- $var; (a variable declared, but without a value)

5

solved Two variables if empty else other [closed]