Created
September 29, 2018 01:09
-
-
Save AhmedHelalAhmed/782914bdbca30e125a5626c19e24b843 to your computer and use it in GitHub Desktop.
info for server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $length_array = array(); | |
| var_dump($_SERVER); | |
| foreach ($_SERVER as $key => $value) | |
| { | |
| $length = strlen($value); | |
| $length_array[$key] = $length; | |
| echo '<pre>'; | |
| print_r($key . " = " . $length . " characters"); | |
| echo '</pre>'; | |
| } | |
| $max_key = array_keys($length_array, max($length_array)); | |
| print_r($max_key . " is longest with " . max($length_array) . " characters"); | |
| ?> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
source : https://stackoverflow.com/questions/52564163/print-out-the-highest-value-and-its-key-from-an-array-php