How can the IF statement be effectively used in PHP to display different navigation menus based on a specific condition?

When needing to display different navigation menus based on a specific condition in PHP, the IF statement can be effectively used. By using an IF statement, you can check the condition and then display the appropriate navigation menu accordingly. This allows for dynamic and conditional rendering of navigation menus based on specific criteria.

<?php
// Example condition to determine which navigation menu to display
$userType = 'admin';

// Check the condition and display the appropriate navigation menu
if ($userType == 'admin') {
    // Display admin navigation menu
    echo '<a href="#">Admin Dashboard</a>';
} else {
    // Display regular user navigation menu
    echo '<a href="#">User Dashboard</a>';
}
?>