Are there best practices for organizing navigation data in PHP to simplify styling changes?

When organizing navigation data in PHP to simplify styling changes, it is best to separate the navigation data from the HTML structure. This can be achieved by storing the navigation data in an array or object, and then dynamically generating the navigation menu using loops in the HTML template. By doing this, styling changes can be easily applied to the navigation menu without having to modify the data structure.

// Navigation data stored in an array
$navItems = [
    'Home' => '/',
    'About' => '/about',
    'Services' => '/services',
    'Contact' => '/contact'
];

// Generating the navigation menu dynamically
echo '<ul>';
foreach ($navItems as $label => $url) {
    echo '<li><a href="' . $url . '">' . $label . '</a></li>';
}
echo '</ul>';