wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_recursive_ksort › WordPress Function

Since6.0.0
Deprecatedn/a
wp_recursive_ksort ( $array )
Parameters:
  • (array) $array The array to sort, passed by reference.
    Required: Yes
Defined at:
Codex:

Sorts the keys of an array alphabetically.

The array is passed by reference so it doesn't get returned which mimics the behavior of ksort.


Source

function wp_recursive_ksort( &$array ) {
	foreach ( $array as &$value ) {
		if ( is_array( $value ) ) {
			wp_recursive_ksort( $value );
		}
	}
	ksort( $array );
}