Click to See Complete Forum and Search --> : Check multiple conditions


alxla
02-09-2007, 12:26 PM
I'm not a so experienced programmer in PHP, and now i have got stuck in a simple operator problem :rolleyes:


if ($page!="myheadisgone")
{
include("templates/head.tpl");
}


This script works just fine, but if i want to check if "$page" is'nt equal with multiple strings like to put them in a string or something like this:


$noheaderarray = array("myheadisgone", "idonothaveahead", "headless");

if ($page!=$noheaderarray)
{
include("templates/head.tpl");
}



So that the if statements test if $page isn't equal to any of the strings in "$noheaderarrray"

NogDog
02-09-2007, 01:07 PM
$noheaderarray = array("myheadisgone", "idonothaveahead", "headless");

if (!in_array($page, $noheaderarray))
{
include("templates/head.tpl");
}

alxla
02-09-2007, 01:17 PM
Oh.. Thanks ;)