How can conditional statements like if-else be used in PHP to display different text based on URL parameters?

To display different text based on URL parameters in PHP, you can use conditional statements like if-else to check the value of the parameters and display corresponding text accordingly. You can retrieve URL parameters using the $_GET superglobal array in PHP. By checking the value of specific parameters using if-else statements, you can dynamically change the displayed text based on the URL parameters.

<?php
// Retrieve URL parameter
$param = $_GET['param'];

// Check the value of the parameter and display different text
if ($param == 'value1') {
    echo "Text for value1";
} elseif ($param == 'value2') {
    echo "Text for value2";
} else {
    echo "Default text";
}
?>