public static SortArray::sortByKeyString($a, $b, $key)
Sorts a string array item by an arbitrary key.
array $a: First item for comparison.
array $b: Second item for comparison.
string $key: The key to use in the comparison.
int The comparison result for uasort().
public static function sortByKeyString($a, $b, $key) { $a_title = (is_array($a) && isset($a[$key])) ? $a[$key] : ''; $b_title = (is_array($b) && isset($b[$key])) ? $b[$key] : ''; return strnatcasecmp($a_title, $b_title); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!SortArray.php/function/SortArray::sortByKeyString/8.1.x