static public function sortByKeyRecursive(array $array)
    {
        ksort($array);
        foreach ($array as $key => $value) {
            if (is_array($value) && !empty($value)) {
                $array[$key] = self::sortByKeyRecursive($value);
            }
        }

        return $array;
    }
static public function sortByKeyRecursive(array $array)
    {
        ksort($array);
        foreach ($array as $key => $value) {
            if (is_array($value) && !empty($value)) {
                $array[$key] = self::sortByKeyRecursive($value);
            }
        }

        return $array;
    }
static public function sortByKeyRecursive ( array $ array ) { ksort ( $ array ) ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) && ! empty ( $ value ) ) { $ array [ $ key ] = self :: sortByKeyRecursive ( $ value ) ; } } return $ array ; }
Sorts an array recursively by key

@param $array Array to sort recursively by key
@return array Sorted array
Sorts an array recursively by key