7
I’m doing a query on my DB, and we can do an identical query on this:
"hello world" "pacific ocean"
What happens is that I can search for several strings at the same time:
Expected result:
String1: Hello World
string2: Pacific Ocean
Strings are divided by a space, but have to be in quotes.
I have the following in code:
$array_seach = explode($search_word, " ");
The problem with this is that it will cut into the first blank space it finds instead of separating the strings. I’ve tried, too, but no result:
$array_seach = explode($search_word, " \"");
$array_seach = explode($search_word, ' \"');
Since I don’t know the number of strings or what is written, how can I fix this?
Your
explode
is the other way around. First is the delimiter, then the word. Example:explode(' ', $search);
– Diego Souza