Skip to content
PHP Logo

How can the code snippet be modified to calculate the end time of an event 10 days from the current time?

The code snippet can be modified to calculate the end time of an event 10 days from the current time by adding 10 days to the current time using the `strtotime` function in PHP. This function allows us to easily manipulate dates and times in PHP.

php
$current_time = time(); // Get the current timestamp
$end_time = strtotime('+10 days', $current_time); // Calculate the end time by adding 10 days to the current time

echo "End time of the event: " . date('Y-m-d H:i:s', $end_time); // Display the end time in a readable format