I have an array with the following elements
PHP Code:
define("LIST_OF_SCHOOLS", "st patricks,Piarsaigh,Phiarsaigh,St Vincents,Glanmire,Farranree,North Presentation,north mon,north monestrey,Scoil iosagain,St aidans,knocknaheeny,mon");
PHP Code:
$schoolList = explode(',', LIST_OF_SCHOOLS);
PHP Code:
function checkForSchool($page, $schoolList) {
preg_match('%(Studied at|Went to|Goes to) \\\u003ca href=\\\\"http:\\\/\\\/www.facebook.com\\\/pages\\\/[a-zA-Z-]*\\\/\d*\\\\" data-hovercard=\\\\"\\\/ajax\\\/hovercard\\\/page.php\?[a-zA-Z=0-9]*\\\\">([a-zA-Z\s]*)\\\u003c\\\/a>%', $page, $match);
if($match && count($match)>0) {
normal($match[2]);
for($cnt=0; $cnt<count($schoolList); $cnt++) {
$school = trim($schoolList[$cnt]);
green(stristr($match[2],$school));
if($school!="" && stristr($match[2], $school)) {
blue($match[2].": Match for school found");
unset($school);
return true;
}
}
}
else
{
red("No school set on profile");
}
unset($school);
return false;
How come my function is returning true for this match
mond Community High School
Inveralmond Community High School: Match for school found
I only want it too return true if all the match corresponds with one of the element in the array $schoolList