What are potential pitfalls when using explode() in PHP?

One potential pitfall when using explode() in PHP is that if the delimiter is not found in the input string, the function will return an array with one element containing the original string. To avoid this issue, you can check if the result of explode() is an array with more than one element before accessing the individual elements.

$input = "Hello World";
$delimiter = ",";
$result = explode($delimiter, $input);

if(count($result) > 1) {
    // Access individual elements of the array
    echo $result[0]; // Output: Hello
    echo $result[1]; // Output: World
} else {
    echo "Delimiter not found in input string.";
}