How can PHP be used to determine and display the correct weekday for pricing on a website?

To determine and display the correct weekday for pricing on a website using PHP, you can use the date() function to get the current day of the week and then use a switch statement to display the corresponding pricing for each weekday.

$weekday = date('N'); // Get the current day of the week (1 = Monday, 2 = Tuesday, ..., 7 = Sunday)

switch ($weekday) {
    case 1:
        echo "Monday pricing: $10";
        break;
    case 2:
        echo "Tuesday pricing: $12";
        break;
    case 3:
        echo "Wednesday pricing: $11";
        break;
    case 4:
        echo "Thursday pricing: $13";
        break;
    case 5:
        echo "Friday pricing: $15";
        break;
    case 6:
        echo "Saturday pricing: $20";
        break;
    case 7:
        echo "Sunday pricing: $18";
        break;
}