How do I test a variable against each entry in an array?
Posted: Thu Oct 26, 2006 8:52 am
Hello All
Does anyone know how I can test a variable against each entry in an array.
I will have code loosely like this:
I would like to be able to store multiple values in $nodisplay, then check $url against each in turn and if it matches any of them I want to exit the script without running mosLoadModules.
Alternatively creating a URL pattern might work so if someone knows how to do that and store it in a variable that might be useful also.
Thanks
Adders
Does anyone know how I can test a variable against each entry in an array.
I will have code loosely like this:
Code: Select all
<head>
$url = substr($_SERVER['REQUEST_URI'],1);;
$nodisplay = "vos_new/index.php?option=com_frontpage&Itemid=1";
</head>
<body>
<?php
if ($nodisplay == $url)
{
return;
}
else
{
mosLoadModules ( 'header', -2);
}
?>
</body>Alternatively creating a URL pattern might work so if someone knows how to do that and store it in a variable that might be useful also.
Thanks
Adders