| 1 |
<?php |
| 2 |
/** |
| 3 |
* Generic helper functions. |
| 4 |
* |
| 5 |
* @package WordPress |
| 6 |
* @since 6.0.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! function_exists( 'wp_recursive_ksort' ) ) { |
| 10 |
/** |
| 11 |
* Sorts the keys of an array alphabetically. |
| 12 |
* The array is passed by reference so it doesn't get returned |
| 13 |
* which mimics the behaviour of ksort. |
| 14 |
* |
| 15 |
* @since 6.0.0 |
| 16 |
* |
| 17 |
* @param array $array The array to sort, passed by reference. |
| 18 |
*/ |
| 19 |
function wp_recursive_ksort( &$array ) { |
| 20 |
foreach ( $array as &$value ) { |
| 21 |
if ( is_array( $value ) ) { |
| 22 |
wp_recursive_ksort( $value ); |
| 23 |
} |
| 24 |
} |
| 25 |
ksort( $array ); |
| 26 |
} |
| 27 |
} |
| 28 |
|