What are the potential pitfalls of using if conditions to create a menu in PHP?

One potential pitfall of using if conditions to create a menu in PHP is that it can become cumbersome and difficult to manage as the menu grows in size. An alternative approach is to use an array to store the menu items and then loop through the array to generate the menu dynamically.

$menuItems = [
    'Home' => 'index.php',
    'About' => 'about.php',
    'Services' => 'services.php',
    'Contact' => 'contact.php'
];

echo '<ul>';
foreach ($menuItems as $label => $url) {
    echo '<li><a href="' . $url . '">' . $label . '</a></li>';
}
echo '</ul>';