Snap Builder Public Codes Library
Snap | Generators | Login | Browse | Search | Enter Code | Export Snap Builder Public Codes Library


Category: PHP Codes Library >> Miscellaneous >> Menu Array

Code Snippet </> Info

Snippet Name: Menu Array

Description: Create a navigation menu based on an array.


Author: Snap Builder <>

Last Modified: 2019-12-15 02:14:02

Language: php

Highlight Mode: html

Copy Codes: Use Free Notepad ++
Bookmark and Share

Snap HTML Code Editor:
Paste the source code, make changes and instantly see it in live preview.
Snap HTML Code Editor

  About Copying
Copied To Clipboard!

<? // Below is the array containing all the menu data: // Add as many as you need // This script found at: Free Public Codes Library $menu = array( "Home" => "index.php", "About Us" => "about_us.php", "Members" => "members.php", "Products" => "products.php", "Services" => "services.php", "Contact Us" => "contact_us.php", ); // Below will generate the menu based on the array. echo "<h3>Navigation</h3><br />"; foreach($menu as $name => $link) { // below will be the output links echo "<a href='$link'>$name</a><br />"; } // End. ?>

[ Snippet Options ]


© 2002 -  Snap Builder Public Codes Library