Code: Select all
$getcurrentpage = $_SERVER['PHP_SELF'];
$i = 0;
$news = array(
"Home" => "home.php",
"Products" => "products.php",
"News" => "news.php",
"Contact" => "contact.php"
);How would I write something to work like follows (where products.php, news.php and contact.php could be selected from the array):
Code: Select all
if ($getcurrentpage equal to ($news[1] to $news[3])){
echo "Non-Home Page\n";
}Code: Select all
while($news = each($news)){
if ($news["value"] == $getcurrentpage){
$page = $news[$i]; //get number of array item
}
$i++;
}
echo $page;