Last active
November 23, 2017 06:01
-
-
Save imvaskii/c48daf6b186dd59b30734897c5134c57 to your computer and use it in GitHub Desktop.
Converts first char of array keys to lowercase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Converts first char of array keys to lowercase | |
* | |
* @param $multd_array | |
* | |
* @return array | |
*/ | |
function maybe_convert_arraykeys_lcfirst( $multd_array ) { | |
$result = []; | |
foreach ( $multd_array as $key => $value ) { | |
$key = ( is_string( $key ) ) ? lcfirst( $key ) : $key; | |
if ( is_array( $value ) ) { | |
$value = $this->maybe_array_keys_lcfirst( $value ); | |
} | |
$result[ $key ] = $value; | |
} | |
return $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment