In PHP, what are the advantages and disadvantages of using preg_split versus explode when splitting file names based on specific delimiters?

When splitting file names based on specific delimiters in PHP, the main advantage of using preg_split is its ability to handle more complex patterns using regular expressions. However, preg_split can be slower and more resource-intensive compared to explode, which is simpler and faster for basic delimiter-based splitting.

// Using preg_split to split file names based on specific delimiters
$file_names = "file1.txt,file2.jpg,file3.doc";
$files = preg_split("/[,.]/", $file_names);

foreach ($files as $file) {
    echo $file . "\n";
}