What are the potential pitfalls of using the explode function in PHP for search queries?

Using the explode function in PHP for search queries can result in inaccurate search results if the search terms contain punctuation or special characters. To solve this issue, it's recommended to use regular expressions to split the search query into individual words, which can handle special characters more effectively.

$search_query = "apple, orange, banana";
$search_terms = preg_split("/[\s,]+/", $search_query);

// Now $search_terms will contain an array of individual search terms