fork download
  1. <?php
  2. $Discounts=array(0=>array('FromArea'=>1,'ToArea'=>0,'Master'=>0,'Slave'=>0),
  3. 1=>array('FromArea'=>0,'ToArea'=>10,'Master'=>5,'Slave'=>0),
  4. 2=>array('FromArea'=>5,'ToArea'=>0,'Master'=>0,'Slave'=>8),
  5. 3=>array('FromArea'=>0,'ToArea'=>0,'Master'=>1,'Slave'=>2),
  6. 4=>array('FromArea'=>0,'ToArea'=>1,'Master'=>7,'Slave'=>5),
  7. );
  8.  
  9.  
  10.  
  11. function DiscountAmount($FromArea, $ToArea, $Master, $Slave)
  12. {
  13. global $Discounts;
  14. foreach ($Discounts as $R) {
  15. if (!empty($FromArea) && empty($ToArea) && empty($Master) && empty($Slave)) {
  16. if ($R["FromArea"] == $FromArea)
  17. return true;
  18. } else if (!empty($FromArea) && !empty($ToArea) && empty($Master) && empty($Slave)) {
  19. if ($R["FromArea"] == $FromArea && $R["ToArea"] == $ToArea)
  20. return true;
  21. } else if (!empty($FromArea) && !empty($ToArea) && !empty($Master) && empty($Slave)) {
  22. if ($R["FromArea"] == $FromArea && $R["ToArea"] == $ToArea && $R["Master"] == $Master)
  23. return true;
  24. } else if (!empty($FromArea) && !empty($ToArea) && !empty($Master) && !empty($Slave)) {
  25. if ($R["FromArea"] == $FromArea && $R["ToArea"] == $ToArea && $R["Master"] == $Master && $R["Slave"] == $Slave)
  26. return true;
  27. } else if (!empty($FromArea) && !empty($ToArea) && !empty($Master) && !empty($Slave)) {
  28. if ($R["FromArea"] == $FromArea && $R["ToArea"] == $ToArea && $R["Master"] == $Master && $R["Slave"] == $Slave)
  29. return true;
  30. }
  31.  
  32. }
  33.  
  34. }
  35.  
  36. echo DiscountAmount(0, 0, 0, 0);
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
Standard output is empty