I am attempting to create a program which can calculate the amount of discount for different ages and members. People aged under 12 can a 50% discount and a additional 10% if their a member. People aged under 18 or over 65 can have a 25% discount and an additional 10% on top if their a member. My program only seems to work if the age is below 12 does anyone have any suggestions on how to fix (go easy on me i'm new to programming).
$ticketPrice = 25;
$age = 25;
$membership = 'Yes';
$finalPrice;
$discount;
$memberDis;
if($age < 12) {
$finalPrice = 25 / 2;
} else if($age < 18) {
$discount = 25 * 0.25;
$finalPrice = 25 - $discount;
} else if($age < 65) {
$discount = 25 * 0.25;
$finalPrice = 25 - $discount;
} else if($membership = 'Yes') {
$discount = $finalPrice * .10;
$memberDis = $dicount * 100;
}
echo "<br />";
echo "<h1>Ticket Example</h1>";
echo 'Inital Ticket Price: '."£".$ticketPrice;
echo "<br />";
echo "Age: ".$age;
echo "<br />";
echo "Member: ".$membership;
echo "<br />";
echo "Final Ticket Price: "."£".$finalPrice;