Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1. <?php
  2.  
  3. $portions = "";
  4. $tier[1] = $_GET['cake-tier-1'];
  5. $tier[2] = $_GET['cake-tier-2'];
  6. $tier[3] = $_GET['cake-tier-3'];
  7. $tier[4] = $_GET['cake-tier-4'];
  8. $tier[5] = $_GET['cake-tier-5'];
  9. $shape = $_GET['cakeshape'];
  10.  
  11.  
  12.         if(!is_numeric($tier[1])) {$tier[1] = 0;}
  13.         if(!is_numeric($tier[2])) {$tier[2] = 0;}
  14.         if(!is_numeric($tier[3])) {$tier[3] = 0;}
  15.         if(!is_numeric($tier[4])) {$tier[4] = 0;}
  16.         if(!is_numeric($tier[5])) {$tier[5] = 0;}
  17.  
  18.         if($tier[1] + $tier[2] + $tier[3] + $tier[4] + $tier[5]<0) {
  19.  
  20. if(strcmp($shape, 'square')) {$portions = $tier[1]^2 + $tier[2]^2 + $tier[3]^2 + $tier[4]^2 + $tier[5]^2;}
  21.  
  22. else { $portions = (($tier[1]/2)^2 +($tier[2]/2)^2 +  ($tier[3]/2)^2 +  ($tier[4]/2)^2 +  ($tier[5]/2)^2 ) * 3.1415;}
  23. }
  24. echo(floor($portions));
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement