What are some potential pitfalls of using preg_split() over explode() in PHP?

Using preg_split() over explode() in PHP can be slower and less efficient, as preg_split() uses regular expressions which are more complex and resource-intensive compared to the simple string matching used by explode(). Additionally, preg_split() can be more error-prone if the regular expression is not crafted correctly. To solve this issue, consider using explode() when splitting a string by a simple delimiter, and reserve preg_split() for cases where more complex pattern matching is required.

// Using explode() to split a string by a simple delimiter
$string = "apple,banana,orange";
$fruits = explode(",", $string);

print_r($fruits);