PHP | Collator create() Function Last Updated : 30 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The Collator::create() function is an inbuilt function in PHP which is used to create a new collector. Syntax: Object oriented style: Collator Collator::create( $locale ) Procedural style: Collator collator_create( $locale ) Parameters: This function accepts single parameter $locale which holds the required collation rules. If a null value is passed for the locale, the default locale collation rules will be used. If empty string ("") or "root" are passed in the locale then UCA rules will be used. Return Value: This function return the new instance of collator object on success, or NULL on error. Below programs illustrate the Collator::create() function in PHP: Program 1: php <?php $coll = collator_create( 'en_US' ); if(isset($coll)){ echo "Collector created"; } else { echo "Collector not created"; } ?> Output: Collector created Program 2: php <?php $coll = collator_create( 'en_US' ); // Declare array and initialize it $arr = array( 'geek', 'geeK', 'Geek', 'geeks' ); // Sort array collator_sort( $coll, $arr ); // Display array content var_export( $arr ); ?> Output: array ( 0 => 'geek', 1 => 'geeK', 2 => 'Geek', 3 => 'geeks', ) Reference: https://www.php.net/manual/en/collator.create.php Comment More infoAdvertise with us Next Article PHP | Collator create() Function jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Intl Similar Reads PHP | collator_compare() Function The collator_compare() function is an inbuilt function in PHP which is used to compare two Unicode strings according to collation rules. Syntax: Procedural style: int collator_compare( $coll, $str1, $str2 ) Object oriented style: int Collator::compare( $str1, $str2 ) Parameters: This function accept 2 min read PHP | Collator __construct() Function The Collator::__construct() function is an inbuilt function in PHP which is used to create a new instance of Collator. Syntax: public Collator::__construct( string $locale ) Parameters: This function accepts single parameter $locale which holds the collation rules. If a null value is passed for the 1 min read 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 | 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 compact() Function The compact() function is an inbuilt function in PHP and it is used to create an array using variables. This function is the opposite of the extract() function. It creates an associative array whose keys are variable names and their corresponding values are array values. Syntax: array compact("varia 2 min read PHP array() Function The array() function is an inbuilt function in PHP which is used to create an array. There are three types of array in PHP: Indexed array: The array which contains numeric index. Syntax: array( val1, val2, val3, ... ) Associative array: The array which contains name as keys. Syntax: array( key=>v 2 min read PHP Array Functions Arrays are one of the fundamental data structures in PHP. They are widely used to store multiple values in a single variable and can store different types of data, such as strings, integers, and even other arrays. PHP offers a large set of built-in functions to perform various operations on arrays. 7 min read PHP extract() Function The extract() Function is an inbuilt function in PHP. The extract() function does array to variable conversion. That is it converts array keys into variable names and array values into variable value. In other words, we can say that the extract() function imports variables from an array to the symbo 3 min read PHP | DsDeque __construct() Function The Ds\Deque::__construct() function is an inbuilt function in PHP which is used to create a new instance. Syntax: Ds\Deque::__construct( $values ) Parameters: This function accepts single parameter $values which holds the traversable object or array to use initial values. Below programs illustrate 2 min read PHP create_function() Function The create_function() is an inbuilt function in PHP which is used to create an anonymous (lambda-style) function in the PHP. Syntax: string create_function ( $args, $code ) Parameters: This function accepts two parameters which is describes below: $args: It is a string type function argument. $code: 2 min read Like