<?php
arr array_change_key_case ( arr $array [, int $case = CASE_LOWER ] )
where,
$array = The working array
$case = To control whether lower or upper case
?>
CASE | ||
CONSTANT | VALUE | PURPOSE |
CASE_LOWER | 0 | Change to lowercase |
CASE_UPPER | 1 | Change to UPPERCASE |
ed48 |
<?php
$basearray01 = ['continents' =>
['South America', 'Europe', 'Asia'],
'countries' =>
['Brasil', 'Portugal', 'Japan']];
var_export($basearray01);
echo '<br>';
$key01 = array_keys($basearray01);
echo '<br>';
var_export($key01);
echo '<br><br><br>';
$chgcase01 = CASE_UPPER;
$basearray01a =
array_change_key_case($basearray01, $chgcase01);
var_export($basearray01a);
echo '<br>';
$key01a = array_keys($basearray01a);
echo '<br>';
var_export($key01a);
?>
<?php
$basearray02 = ["EDforty-EIGHT" => "PHP",
"edFORTY-eight" => "Apache"];
print_r($basearray02);
echo '<br>';
$key02 = array_keys($basearray02);
echo '<br>';
print_r($key02);
echo '<br><br><br>';
$chgcase02 = CASE_LOWER;
$basearray02a =
array_change_key_case($basearray02, $chgcase02);
print_r($basearray02a);
echo '<br>';
$key02a = array_keys($basearray02a);
echo '<br>';
print_r($key02a);
?>
<?php
$basearray03 = array (1 => array (3, 7), 2 => array (11, 13));
var_dump($basearray03);
echo '<br>';
$key03 = array_keys($basearray03);
echo '<br>';
var_dump($key03);
echo '<br><br><br>';
$chgcase03 = CASE_LOWER;
$basearray03a =
array_change_key_case($basearray03, $chgcase03);
var_dump($basearray03a);
echo '<br>';
$key03a = array_keys($basearray03a);
echo '<br>';
var_dump($key03a);
?>
<?php
$basearray04 = array ("EDforty-EIGHT" => "PHP",
"edFORTY-eight" => "Apache",
"EDFORTY-EIGHT" => "MySQL" );
var_export($basearray04);
echo '<br>';
$key04 = array_keys($basearray04);
echo '<br>';
var_export($key04);
echo '<br><br><br>';
$chgcase04 = -10.76;
$basearray04a =
array_change_key_case($basearray04, $chgcase04);
var_export($basearray04a);
echo '<br>';
$key04a = array_keys($basearray04a);
echo '<br>';
var_export($key04a);
?>
<?php
$var05 = "EDforty-eight";
var_export($var05);
echo '<br>';
$chgcase05 = 0;
$var05a = array_change_key_case($var05, $chgcase05);
var_export($var05a);
echo '<br>';
$key05a = array_keys($var05a);
echo '<br>';
var_export($key05a);
?>