How can PHP's explode function be utilized to split a filename based on a specific delimiter?
To split a filename based on a specific delimiter using PHP's explode function, you can use the delimiter as a parameter to the explode function. This will break the filename into an array of substrings based on where the delimiter occurs. You can then access the different parts of the filename by indexing the array.
$filename = "example_file.txt";
$delimiter = "_";
$parts = explode($delimiter, $filename);
echo "Filename: " . $filename . "<br>";
echo "Parts:<br>";
foreach ($parts as $part) {
echo $part . "<br>";
}