I'm learning PHP and I would like to display a different price for my product according to the day of the week. For example on Mondays the price should be 50% off, on Wednesdays it should have a 10% more expensive and so on. I was thinking of using a function with a switch statement but I can't make it to work. Hope somebody can give me some tips!
function day_of_week($day) {
$day = "Monday";
switch ($day) {
case "Monday":
$key['price'] / 2;
break;
case "Wednesday":
$key['price'] * 1.1;
break;
case "Friday":
if($key['price'] >= 200) {
$key['price'] - 20;
}
}
}
Today's price:
<?php echo day_of_week($day); ?>