How can a function be created in PHP to add a variable number of minutes to a timestamp?

To create a function in PHP that adds a variable number of minutes to a timestamp, you can use the `strtotime()` function to convert the timestamp to a Unix timestamp, then add the desired number of minutes in seconds, and finally convert it back to a formatted date using the `date()` function.

function addMinutesToTimestamp($timestamp, $minutes) {
    $timestamp = strtotime($timestamp);
    $timestamp += $minutes * 60;
    return date('Y-m-d H:i:s', $timestamp);
}

// Example usage
$timestamp = '2022-01-01 12:00:00';
$minutesToAdd = 30;
$newTimestamp = addMinutesToTimestamp($timestamp, $minutesToAdd);
echo $newTimestamp;