How can a PHP if statement be used to conditionally display content based on a variable value?

To conditionally display content based on a variable value in PHP, you can use an if statement. The if statement checks if a certain condition is true, and if it is, it executes the code block inside the if statement. This allows you to show or hide content based on the value of a variable.

// Example variable
$variable = 10;

// Check the value of the variable and display content accordingly
if ($variable > 5) {
    echo "The variable is greater than 5.";
} else {
    echo "The variable is not greater than 5.";
}