Advertisement
touhid_xml

Finding the highest number using elseif PHP

Apr 1st, 2015
520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $goru = 2000;
  3. $chagol = 3000;
  4. $hash = 4000;
  5. $murgi = 5000;
  6. $biral = 6000;
  7.  
  8. $max = max($goru,$chagol,$hash,$murgi,$biral); //highest number
  9.  
  10. if( $goru  == $max ){
  11. echo "Maximum amount is Goru: {$goru}";
  12. }elseif($chagol  == $max){
  13.     echo "Maximum amount is Chagol: {$chagol}";
  14. }
  15. elseif($hash  == $max){
  16.     echo "Maximum amount is Hash: {$hash}";
  17. }
  18. elseif($murgi  == $max){
  19.     echo "Maximum amount is Murgi: {$murgi}";
  20.  
  21. }elseif($biral  == $max){
  22.     echo "Maximum amount is Biral: {$biral}";
  23. }
  24.  
  25. else{
  26.     echo "An Unexpected Error occured";
  27. }
  28.  
  29. /*************************
  30.  * created by Touhid
  31.  * touhid@rafusoft.com
  32.  ************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement