Hi,
I am creating an Image Search Engine. Currently, my script does bold the matching words on the keyword. But, some keywords are too long just like the followings.
When I search for shah rukh khan, there is an image with the following keyword.
25216d1235653089 shahrukh khan s wallpaper shah rukh actor
As you see, the above keyword is too long. So, I need it to be like the following one.
shahrukh khan s wallpaper
| or |
shah rukh actor
Currently, I am using the following code but it requires a space before and after the bold tags. So, if the 1st word is bold, it displays the whole keyword.
if(strlen($img_keyword)>30){
$img_keyword = preg_replace('/(.*?) <b>(.*?)<\/b> (.*?)/us'," <b>$2</b> ",$img_keyword);
}
Is there a way to do/fix this?
Thank you, pnm123