php - Looking for array_map equivalent to work on keys in associative arrays -


suppose have associative array:

    $array = array(       "key1" => "value",       "key2" => "value2"); 

and wanted make keys uppercase. how in generalized way (meaning apply user defined function apply key names)?

you can use array_change_key_case function of php

<?php $input_array = array("first" => 1, "second" => 4); print_r(array_change_key_case($input_array, case_upper)); ?> 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -