3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $test = array( "foo" => "bar", "biz" => "baz" ); function normalizeCapitalization($assert, $lowercaseParameter) { if (isset($assert[$lowercaseParameter])){ $uppercaseParameter = ucfirst($lowercaseParameter); $assert[$uppercaseParameter] = $assert[$lowercaseParameter]; unset($assert[$lowercaseParameter]); } return $assert; } $test = normalizeCapitalization($test, "foo"); $test = normalizeCapitalization($test, "bar"); print_r($test);
based on KcSvl
Output for 4.3.0 - 7.2.0
Array ( [biz] => baz [Foo] => bar )