Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**$goru = 2000;
- $chagol = 3000;
- $hash = 4000;
- $murgi = 5000;
- $biral = 6000;**/
- $animals = array(
- "goru" => 2000,
- "chagol" => 3000,
- "hash" => 4000,
- "murgi" => 5000,
- "biral" => 6000
- );
- $max = max($animals); //maximum value
- foreach($animals as $key => $value){ //loop the array to find maximum value with key
- if($value == $max){
- echo "Maximum amount animal is {$key}: {$value}\n";
- break; //if found the maximum value with key exit from the loop by break keyword.
- }
- }
- /*************************
- * created by Touhid
- * touhid@rafusoft.com
- ************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement