What are the potential pitfalls of trying to concatenate an if statement within an echo statement in PHP?

Concatenating an if statement within an echo statement in PHP can lead to syntax errors or unexpected results. To avoid this, it's better to separate the if statement from the echo statement and concatenate the result of the if statement with the echo statement.

<?php
// Separate the if statement from the echo statement and concatenate the result
$value = 10;
$result = ($value > 5) ? 'greater than 5' : 'less than or equal to 5';
echo 'The value is ' . $result;
?>