What are the potential issues with using if statements within echo statements in PHP code?

Using if statements within echo statements in PHP code can lead to readability issues and make the code harder to maintain. It is recommended to separate the conditional logic from the output generation for better code organization. To solve this issue, you can store the result of the conditional check in a variable and then use that variable in the echo statement.

<?php
$condition = true;

if ($condition) {
    $output = "Condition is true";
} else {
    $output = "Condition is false";
}

echo $output;
?>