How can I most effectively compare values in an array to other values in another array?
My code:
//explode the skills located in the database field
$skills = explode(" ", $skills2);
//explode the skills entered into SKILLS search form, based on spaces
$chars = preg_split('/ /', $_POST['skills'], -1, PREG_SPLIT_OFFSET_CAPTURE);
//compare the arrays so we can see how many keywords were an exact match from the ones entered
//bold the ones that matched
foreach ($chars as $value) {
echo $value;
while ($chars == $value) {
echo "Test":
}
}
Does this make sense, what I'm attempting to do?