how_much_beer.php = $beer) { $total_money -= $beer; } elseif ($bottle_num = ($beer/$bottle)) { $bottle_num -= ($beer/$bottle); } elseif ($cap_num = ($beer/$cap)) { $cap_num -= ($beer/$cap); } $bottle_num++; $cap_num++; $num++; echo 'Money:'
= $beer) { $total_money -= $beer; } elseif ($bottle_num >= ($beer/$bottle)) { $bottle_num -= ($beer/$bottle); } elseif ($cap_num >= ($beer/$cap)) { $cap_num -= ($beer/$cap); } $bottle_num++; $cap_num++; $num++; echo 'Money:' . ($total_money/10) . ' Bottle(s): ' . $bottle_num; echo ' Cap(s): '. $cap_num . " ----> Beers: " . $num . ''; if($total_money<2 AND $bottle_num<2 AND $cap_num<4) break; } echo 'Result beer number: ' . $num . ' Bottle: ' . $bottle_num . ' Cap: ' . $cap_num;