PHP | collator_sort_with_sort_keys() Function Last Updated : 29 Oct, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The collator_sort_with_sort_keys() function is an inbuilt function in PHP which is used to sort array using specified collator and sort keys. Syntax: Procedural style: bool collator_sort_with_sort_keys( $coll, $arr ) Object oriented style: bool Collator::sortWithSortKeys( $arr ) Parameters: This function accepts two parameters as mentioned above and described below: $coll: This parameter is used as collator object. It provides the comparison capability with support for appropriate locale-sensitive sort orderings. $arr: This parameter is used to hold the string which needs to sort. Return Value: This function returns True on success or False on failure. Below programs illustrates the collator_sort_with_sort_keys() function in PHP. Program 1: php <?php // Declare an array which need to sort $arr = array( 'Geeks', 'g4g', 'GeeksforGeeks', 'geek' ); $coll = collator_create( 'gs' ); // Sort the array with key value collator_sort_with_sort_keys( $coll, $arr ); var_export( $arr ); ?> Output: array ( 0 => 'g4g', 1 => 'geek', 2 => 'Geeks', 3 => 'GeeksforGeeks', ) Program 2: php <?php // Declare an array which need to sort $arr = array( 'Geeks123', 'GeeksABC', 'GeeksforGeeks', 'Geeks' ); // Create collector $coll = collator_create( 'en_US' ); // Sort the array with key value collator_sort_with_sort_keys( $coll, $arr ); var_export( $arr ); ?> Output: array ( 0 => 'Geeks', 1 => 'Geeks123', 2 => 'GeeksABC', 3 => 'GeeksforGeeks', ) Reference: http://php.net/manual/en/collator.sortwithsortkeys.php Comment More infoAdvertise with us Next Article PHP | collator_sort_with_sort_keys() Function V vijay_raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | collator_sort() Function The collator_sort() function is an inbuilt function in PHP which is used to sort an array using specified collator. This function returns True on success or False on failure. Syntax: Procedural style: bool collator_sort( $coll, $arr, $sort_flag ) Object oriented style: bool Collator::sort( $arr, $so 2 min read PHP | DsVector sort() Function The Ds\Vector::sort() function is an inbuilt function in PHP which is used to sort the elements of vector in-place. This will arrange the vector elements in increasing order. Syntax: void public Ds\Vector::sort( $comparator ) Parameters: This function accepts a single parameter $comparator which is 2 min read PHP | DsVector sorted() Function The Ds\Vector::sorted() function is an inbuilt function in PHP which is used to sort the elements of the vector by creating a copy of the original vector. This will arrange the vector elements in increasing order using default comparator. Syntax: Ds\Vector public Ds\Vector::sorted( $comparator ) Par 2 min read PHP | collator_asort() Function The collator_asort() function is an inbuilt function in PHP which is used to sort array maintaining the index association. This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. The array elements are sorted according to curr 2 min read PHP SplObjectStorage key() Function The SplObjectStorage::key() function is an inbuilt function in PHP which is used to get the index of the currently pointing iterator. Syntax: int SplObjectStorage::key() Parameters: This function does not accept any parameter. Return Value: This function returns the index at which the iterator curre 1 min read Like