[PR][php-src][#1123][master] - Sortable interface - variation

From: Date: Fri, 27 Feb 2015 01:25:28 +0000
Subject: [PR][php-src][#1123][master] - Sortable interface - variation
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-2498@lists.php.net to get a copy of this message
You can view the Pull Request on github: https://github.com/php/php-src/pull/1123 Pull Request Description: Another idea of implementation of the interface Sortable. Works with *sort() functions. Could be quite powerful when combined with Comparable (#1097) Introduces a new constant: SORT_FLAG_REVERSE /** @ingroup SPL * @brief This Interface allows to hook into the global Xsort() functions. * @since PHP 5.6 */ interface Sortable { /** * Sort the entries by values. * * @param integer $sort_flags * SORT_REGULAR: compare items normally (don't change types) * SORT_NUMERIC: compare items numerically * SORT_STRING: compare items as strings * SORT_LOCALE_STRING: compare items as strings, based on the current locale. It uses the locale, which can be changed using setlocale() * SORT_NATURAL: compare items as strings using "natural ordering" like natsort() * SORT_FLAG_CASE: can be combined (bitwise OR) with SORT_STRING or SORT_NATURAL to sort strings case-insensitively * SORT_FLAG_REVERSE: can be combined (bitwise OR) with any of the other options to sort in reverse */ function sort($sort_flags = SORT_REGULAR); /** Sort the entries by values using user defined function. */ function usort(mixed cmp_function); } /** @ingroup SPL * @brief This Interface allows to hook into the global XaXsort() functions. * @since PHP 5.6 */ interface SortableAssoc { /** * Sort the entries by values and maintain indexes. * * @param integer $sort_flags * SORT_REGULAR: compare items normally (don't change types) * SORT_NUMERIC: compare items numerically * SORT_STRING: compare items as strings * SORT_LOCALE_STRING: compare items as strings, based on the current locale. It uses the locale, which can be changed using setlocale() * SORT_NATURAL: compare items as strings using "natural ordering" like natsort() * SORT_FLAG_CASE: can be combined (bitwise OR) with SORT_STRING or SORT_NATURAL to sort strings case-insensitively * SORT_FLAG_REVERSE: can be combined (bitwise OR) with any of the other options to sort in reverse */ function asort($sort_flags = SORT_REGULAR); /** Sort the entries by values using user defined function and maintain index. */ function uasort(mixed cmp_function); } /** @ingroup SPL * @brief This Interface allows to hook into the global XkXsort() functions. * @since PHP 5.6 */ interface SortableKeys { /** * Sort the entries by key. * * @param integer $sort_flags * SORT_REGULAR: compare items normally (don't change types) * SORT_NUMERIC: compare items numerically * SORT_STRING: compare items as strings * SORT_LOCALE_STRING: compare items as strings, based on the current locale. It uses the locale, which can be changed using setlocale() * SORT_NATURAL: compare items as strings using "natural ordering" like natsort() * SORT_FLAG_CASE: can be combined (bitwise OR) with SORT_STRING or SORT_NATURAL to sort strings case-insensitively * SORT_FLAG_REVERSE: can be combined (bitwise OR) with any of the other options to sort in reverse */ function ksort($sort_flags = SORT_REGULAR); /** Sort the entries by key using user defined function. */ function uksort(mixed cmp_function); }

« previous php.git-pulls (#2498) next »