What are the potential pitfalls or errors that can occur when using explode() in PHP, as seen in the provided code snippet?

When using explode() in PHP, one potential pitfall is not checking if the delimiter exists in the input string before calling explode(). This can result in an error if the delimiter is not found, causing the script to break. To solve this issue, you should first check if the delimiter exists in the input string using strpos() before calling explode().

// Check if the delimiter exists in the input string before using explode()
$input = "Hello,World";
$delimiter = ",";
if(strpos($input, $delimiter) !== false){
    $parts = explode($delimiter, $input);
    print_r($parts);
} else {
    echo "Delimiter not found in input string.";
}