3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<html> <body> <?php function array_change_value_case($input, $ucase) { $case = $ucase; $narray = array(); if (!is_array($input)) { return $narray; } foreach ($input as $key => $value) { if (is_array($value)) { $narray[$key] = array_change_value_case($value, $case); continue; } $narray[$key] = ($case == CASE_UPPER ? strtoupper($value) : strtolower($value)); } return $narray; } $Names = array('A' => 'Abdul Azim', 'B' => 'Abdul Rahman', 'c' => 'Arshad Ayub'); echo '</br>Values are in lower case.</br>'; $myNames = array_change_value_case($Names,CASE_LOWER); print_r($myNames); echo '</br>Values are in upper case.</br>'; $myNames = array_change_value_case($Names,CASE_UPPER); print_r($myNames); ?> </html> </body>
Output for 4.3.0 - 5.6.26, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
<html> <body> </br>Values are in lower case.</br>Array ( [A] => abdul azim [B] => abdul rahman [c] => arshad ayub ) </br>Values are in upper case.</br>Array ( [A] => ABDUL AZIM [B] => ABDUL RAHMAN [c] => ARSHAD AYUB ) </html> </body>