What are some potential pitfalls when using explode in PHP for parsing text files?

One potential pitfall when using explode in PHP for parsing text files is that it splits the text based on a single delimiter, which may not always be sufficient for complex file structures. To address this, consider using a more robust parsing method like regular expressions or the explode function with a loop for more precise text extraction.

$file = file_get_contents('example.txt');
$lines = explode("\n", $file);

foreach($lines as $line){
    $parts = explode(",", $line);
    
    // Process each part accordingly
}