Skip to main content
2 of 5
for code blocks, use 4 spaces (not tabs) before each line

Calculating a total price with group pricing

I'm evaluating a meeting_type value that determines what kind of pricing structure I should be using. Currently, if my meeting_type value is a w, we charge one price for every 10 registrants. If the meeting_type is anything else, it's a price per registrant model.

I'm using this logic:

if($_POST['meeting_type'] != 'w'){          
    $total_price = $guests * $price;
}
else{
    $webinar_count = ceil($guests / 10);
    $total_price = $webinar_count * $price;
}

Can this logic be flawed, or improved upon?

Thanks.

etm124
  • 143
  • 4