php - Strpos find brand names -


$pos = strpos($arr_row1['name'], $arr_row['value']." "); if ($pos !== false){ 

the following code helps me match product title brand have array of brands "gopro", "hp" etc... unusual brands such "dy" "ge". problem code match "ready" brand "dy" , if chacne match " " . brand . " " not match brands title if stars "hp laptop" ideas how avoid issues , still match right brand title?

try following :

$pos = preg_match('/\b('.$arr_row1['name'].')\b/', $arr_row['value']); if ($pos == 1) { 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c# - Avoiding duplicate methods for Task and Task<T> -

javascript - Which segment of a polyline was clicked? -