I would ask the user input the search words in string, and separated by ",".
So the input could be
"cars, trucks, limos" or "cars,trucks,limos" or " cars , trucks,limos " etc. as long as they are separated by ","
How can I to make this imput to display exactly as
'cars', 'trucks', 'limos'
Not 'cars', ' trucks', ' limos' or ' cars ', ' trucks', 'limos ' etc.
So I can use the value
'cars', 'trucks', 'limos'
in the database in set search, without the space in the way.
Do I have to
1) first covert the input strings -"cars, trucks, limos" or "cars,trucks,limos" or " cars , trucks,limos " etc., to array using split.
2) And walk through the array, trim off the space for every element.
3) And then use the implode covert it back to string and every element wrapped up by ' '?
I assumed this will be a popular requirement in database search and php. Is there a simple solution?
By the way, 'cars', 'trucks', 'limos' is different than 'cars', ' trucks', ' limos' or ' cars ', ' trucks', 'limos ' in the database in set matching, right?
Thanks!