You are here

public static function SortArray::recursiveKeySort in Markdown 8.2

Recursively sorts an array by key.

Parameters

array $array: An array to sort, passed by reference.

2 calls to SortArray::recursiveKeySort()
SettingsTrait::getSettingOverrides in src/Traits/SettingsTrait.php
SettingsTrait::getSettings in src/Traits/SettingsTrait.php

File

src/Util/SortArray.php, line 75

Class

SortArray
Array sorting helper methods.

Namespace

Drupal\markdown\Util

Code

public static function recursiveKeySort(array &$array) {

  // First, sort the main array.
  ksort($array);

  // Then check for child arrays.
  foreach ($array as $key => &$value) {
    if (is_array($value)) {
      static::recursiveKeySort($value);
    }
  }
}