Questo codice
Codice PHP:
$input_example = array('
uno' => '1', 'Due' => array(21 => 'ventuno', 22 => array('test1' => 'test')), 3 => 3);
print_r($input_example);
function upperAll($var)
{
if(!is_array($var))
return strtoupper($var);
$result = array();
foreach($var as $key=>$value)
$result[upperAll($key)] = upperAll($value);
return $result;
}
echo "
";
$input_example = upperAll($input_example);
print_r($input_example);
Produce questo output
Codice PHP:
Array ( [ uno] => 1 [Due] => Array ( [21] => ventuno [22] => Array ( [test1] => test ) ) [3] => 3 )
Array ( [ UNO] => 1 [DUE] => Array ( [21] => VENTUNO [22] => Array ( [TEST1] => TEST ) ) [3] => 3 )