How can multiple IF statements be nested in PHP to create dependent conditions?

When dealing with multiple dependent conditions in PHP, you can nest IF statements within each other to create a hierarchy of conditions. This means that the execution of certain code blocks will depend on the outcome of previous conditions being met. By properly nesting IF statements, you can create complex logic flows that handle various scenarios based on multiple conditions.

// Example of nested IF statements in PHP
$age = 25;
$gender = 'male';

if ($age >= 18) {
    if ($gender == 'male') {
        echo "You are a male adult.";
    } else {
        echo "You are a female adult.";
    }
} else {
    echo "You are not an adult.";
}