How can the PHP echo function be used to output different results based on conditions?

To output different results based on conditions using the PHP echo function, you can use conditional statements such as if, else if, and else. These statements allow you to check certain conditions and then echo different results based on the outcome of those conditions.

<?php
$number = 10;

if ($number > 0) {
    echo "Number is positive";
} else if ($number < 0) {
    echo "Number is negative";
} else {
    echo "Number is zero";
}
?>