Jump to content

[SOLVED] Arrays and echoing all


plutomed

Recommended Posts

I have this bit of code and it seems to only echo the first one in te array, why?

 

<?php
function main_nav()
{
$main_nav = array(
	"names" => array("Home", "Pictures", "Templates", "Website Coding"),
	"pages" => array("index.php", "pictures.php", "templates.php", "website_coding.php")
);

$count_main = count($main_nav['names']);
$i_main = 0;
$i_main2 = 10;
$links .= " <a href=\"".$main_nav['pages'][$i_main]."\" class=\"glink\" id=\"g".$i_main2."\">".$main_nav['names'][$i_main]."</a> ";
echo $links;
while($i_main < $count_main)
{
	$i_main++;
	$i_main2++;
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/65138-solved-arrays-and-echoing-all/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.