Let's say I have Table Tennis in my array [Table Tennis, Basketball, Swimming, ...] and the user input is tabletennis, how can I make it so that it is a match?
This is what I have currently and $q is user input and $skills is my array:
if (preg_grep("/$q/i", $skills)){
$skill = implode(" ", preg_grep("/$q/i", $skills));
$searchRows[$key]['skills'] = '<a href="javascript:void(0)" class="label label-info">' . $skill . '</a>';
}else{
$searchRows[$key]['skills'] = count($skills) . ' skills';
}
Thanks for the help in advance.
Aucun commentaire:
Enregistrer un commentaire