How can the explode function in PHP be used to manipulate time data effectively?

When working with time data in PHP, the explode function can be used to split a string into an array based on a specified delimiter. This can be helpful for manipulating time data effectively, such as converting a time string into individual hour, minute, and second components for further processing.

$time = "12:30:45";
$time_parts = explode(":", $time);

$hour = $time_parts[0];
$minute = $time_parts[1];
$second = $time_parts[2];

echo "Hour: $hour, Minute: $minute, Second: $second";