What potential pitfalls should be considered when using split() or explode() functions in PHP to split strings based on a delimiter?

When using split() or explode() functions in PHP to split strings based on a delimiter, potential pitfalls to consider include: 1. Not checking if the delimiter exists in the string before splitting, which can lead to unexpected results or errors. 2. Not handling empty elements that may result from consecutive delimiters in the string. 3. Not considering the performance implications of splitting large strings. To address these pitfalls, you should always check if the delimiter exists in the string before splitting and handle empty elements appropriately.

$string = "apple,banana,,orange";
$delimiter = ",";
if (strpos($string, $delimiter) !== false) {
    $result = array_filter(explode($delimiter, $string));
    print_r($result);
} else {
    echo "Delimiter not found in the string.";
}