What is the best function to use in PHP to split a string into an array based on a delimiter?

To split a string into an array based on a delimiter in PHP, you can use the `explode()` function. This function takes two parameters: the delimiter on which to split the string and the string itself. It will return an array of substrings based on the delimiter.

$string = "apple,banana,orange,grape";
$delimiter = ",";
$array = explode($delimiter, $string);

print_r($array);