How can the explode() function be utilized to manipulate dates in PHP?

To manipulate dates in PHP using the explode() function, you can split a date string into an array of its components (day, month, year) based on a specified delimiter. This allows you to easily access and modify individual date components before reformatting the date as needed.

$date = "2022-10-15";
$date_components = explode("-", $date);

$year = $date_components[0];
$month = $date_components[1];
$day = $date_components[2];

// Manipulate date components as needed
$new_date = $year . "-" . $month . "-" . $day;
echo $new_date; // Output: 2022-10-15