as you can see from the code the variable uri is also an array but I am looping through it and trying to see if it exists in the array linkList.
data should be as follows.
uri
Array ( [0] => [1] => services [2] => graphic [3] => web )
linkList
Array ( [0] => contact-menu [1] => graphic-design-submenu [2] => services-menu )
for example find graphic (uri[2]) in linklist (linkList[1]) and return the index of linkList.
I know I could do it with a couple of for or while loops but was wondering if there is an easier way.
And yes, I know that my for loop counts down instead of up becuase of the way that I will have to display the data.
Code: Select all
function createExplode()
{
global $linkList;
$uri= explode("/", $_SERVER['REQUEST_URI']);
$x = count($uri);
for($y = $x; $y > 0; $y--)
{
$temp = $uri[$y-1];
if($num = strstr($temp, array_search($temp, $linkList)))
{
echo ($linkList[$num]);
}
else
{
echo "not found<br />";
}
}
}phpScott