Current Location: Home> Function Categories> strcoll

strcoll

Comparison of strings based on locale settings
Name:strcoll
Category:String
Programming Language:php
One-line Description:Compare two strings (according to local settings).

Definition and usage

strcoll() function compares two strings.

Comparison of strings varies according to local settings (A<a or A>a).

Note: strcoll() is case sensitive, but not binary safe.

Note: If the current local setting is C or POSIX, the function works the same way as strcmp() .

Example

Compare strings:

 <?php
setlocale ( LC_COLLATE , 'NL' ) ;
echo strcoll ( "Hello World!" , "Hello World!" ) ;
echo "<br>" ;

setlocale ( LC_COLLATE , 'en_US' ) ;
echo strcoll ( "Hello World!" , "Hello World!" ) ;
?>

Try it yourself

grammar

 strcoll ( string1 , string2 )
parameter describe
string1 Required. Specifies the first string to be compared.
string2 Required. Specifies the second string to be compared.
Similar Functions
  • Generate single-byte strings from numbers chr

    chr

    Generatesingle-bytes
  • Repeat a string str_repeat

    str_repeat

    Repeatastring
  • Format a number in a thousand separator number_format

    number_format

    Formatanumberinathou
  • Calculate the sha1 hash value of a string sha1

    sha1

    Calculatethesha1hash
  • Convert strings to arrays str_split

    str_split

    Convertstringstoarra
  • Remove spaces (or other characters) from the beginning and end of the string trim

    trim

    Removespaces(orother
  • Find the last occurrence of a specified character in a string strrchr

    strrchr

    Findthelastoccurrenc
  • String comparison using the "natural order" algorithm strnatcmp

    strnatcmp

    Stringcomparisonusin
Popular Articles