What are some potential pitfalls to be aware of when using PHP's explode function to separate a string?

One potential pitfall when using PHP's explode function is that if the delimiter used to separate the string is not found in the input string, the function will return an array with a single element containing the original string. To avoid this issue, you can check if the delimiter exists in the input string before using the explode function.

$input_string = "Hello World";
$delimiter = ",";
if (strpos($input_string, $delimiter) !== false) {
    $result = explode($delimiter, $input_string);
    print_r($result);
} else {
    echo "Delimiter not found in input string.";
}