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 | ctype_cntrl() Function The ctype_cntrl() function is an inbuilt function in PHP and is used to check if all the characters of a given string are control characters or not. It returns True if all characters of the string are control characters otherwise it returns false.Control Character: A character that does not represen 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 ftruncate( ) Function The ftruncate() function in PHP is an inbuilt function that is used to truncate(shorten) an open file to the specified length. The file and the new size of the file are sent as parameters to the ftruncate() function and it returns True on success and False on Failure. If the size specified in the pa 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 | class_exists() Function The class_exists() function is an inbuilt function in PHP which is used to check whether the given class is defined or not. Syntax: bool class_exists( string $class_name, bool $autoload = TRUE ) Parameters: This function accept two parameters as mentioned above and described below: $class_name: It h 2 min read Like