foreach always returns true/false?
Posted: Sun Mar 18, 2007 11:31 pm
This somewhat simple script is supposed to detect (X)HTML validators and allow cloaking to compensate for errors in web standards. However it's always returns true or false (not sure which it is).
Code: Select all
<?php
$useragent = $_SERVER['HTTP_USER_AGENT'];
$validator = array(
'W3C_Validator',
'WDG_Validator',
);
foreach ($validator as $ua) {
if (stristr($validator,$ua)) {
$result = TRUE;
break;
}else{
$result = FALSE;
}
}
if(!$result)
{echo 'not result';}
else
{echo 'result';}
echo '<br />' . $useragent;
?>