What is the purpose of using explode() function in PHP in the given code snippet?

The purpose of using the explode() function in PHP in the given code snippet is to split a string into an array based on a specified delimiter. In this case, the code is splitting the $str variable into an array using the comma (,) delimiter. Code snippet:

$str = "apple,banana,orange";
$fruits = explode(",", $str);

print_r($fruits);
```

This code snippet will output:
```
Array
(
    [0] => apple
    [1] => banana
    [2] => orange
)