How can PHP be used to differentiate between weekend and weekday prices for online bookings?

To differentiate between weekend and weekday prices for online bookings in PHP, you can use the date() function to determine the day of the week and then apply different pricing logic based on whether it is a weekday or weekend.

// Get the current day of the week
$dayOfWeek = date('N');

// Set default price
$price = 100;

// Check if it's a weekend (Saturday or Sunday)
if ($dayOfWeek >= 6) {
    $price = 150; // Weekend price
}

echo "Price for booking: $" . $price;