本文整理匯總了PHP中JArrayHelper::sortLocale方法的典型用法代碼示例。如果您正苦於以下問題:PHP JArrayHelper::sortLocale方法的具體用法?PHP JArrayHelper::sortLocale怎麽用?PHP JArrayHelper::sortLocale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JArrayHelper
的用法示例。
在下文中一共展示了JArrayHelper::sortLocale方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sortObjects
/**
* Utility function to sort an array of objects on a given field
*
* @param array &$a An array of objects
* @param mixed $k The key (string) or an array of keys to sort on
* @param mixed $direction Direction (integer) or an array of direction to sort in [1 = Ascending] [-1 = Descending]
* @param mixed $caseSensitive Boolean or array of booleans to let sort occur case sensitive or insensitive
* @param mixed $locale Boolean or array of booleans to let sort occur using the locale language or not
*
* @return array The sorted array of objects
*
* @since 11.1
* @deprecated 4.0 Use Joomla\Utilities\ArrayHelper::sortObjects instead
*/
public static function sortObjects(&$a, $k, $direction = 1, $caseSensitive = true, $locale = false)
{
if (!is_array($locale) || !is_array($locale[0])) {
$locale = array($locale);
}
self::$sortCase = (array) $caseSensitive;
self::$sortDirection = (array) $direction;
self::$sortKey = (array) $k;
self::$sortLocale = $locale;
usort($a, array(__CLASS__, '_sortObjects'));
self::$sortCase = null;
self::$sortDirection = null;
self::$sortKey = null;
self::$sortLocale = null;
return $a;
}