Robert Granlund
asked on
PHP a Better way to write an IF statement
PHP: Is there a better/cleaner way to write the following?
if (empty($simple_location) && empty($var_location)) {
$loc = '<p>' . join(' : ', $links) . '</p>';
} else {
$loc = '';
}
if(!empty ($simple_location)) {
$loc_a = '<p>' . $simple_location. '</p>';
} else {
$loc_a = '';
}
if(!empty ($var_location)) {
$loc_b = '<p>' . $var_location. '</p>';
} else {
$loc_b = '';
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window