Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $portions = "";
- $tier[1] = $_GET['cake-tier-1'];
- $tier[2] = $_GET['cake-tier-2'];
- $tier[3] = $_GET['cake-tier-3'];
- $tier[4] = $_GET['cake-tier-4'];
- $tier[5] = $_GET['cake-tier-5'];
- $shape = $_GET['cakeshape'];
- if(!is_numeric($tier[1])) {$tier[1] = 0;}
- if(!is_numeric($tier[2])) {$tier[2] = 0;}
- if(!is_numeric($tier[3])) {$tier[3] = 0;}
- if(!is_numeric($tier[4])) {$tier[4] = 0;}
- if(!is_numeric($tier[5])) {$tier[5] = 0;}
- if($tier[1] + $tier[2] + $tier[3] + $tier[4] + $tier[5]<0) {
- if(strcmp($shape, 'square')) {$portions = $tier[1]^2 + $tier[2]^2 + $tier[3]^2 + $tier[4]^2 + $tier[5]^2;}
- else { $portions = (($tier[1]/2)^2 +($tier[2]/2)^2 + ($tier[3]/2)^2 + ($tier[4]/2)^2 + ($tier[5]/2)^2 ) * 3.1415;}
- }
- echo(floor($portions));
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement