PHP strcoll () function
Examples
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!");
?>
setlocale (LC_COLLATE, 'NL');
echo strcoll("Hello World!","Hello World!");
echo "<br>";
setlocale (LC_COLLATE, 'en_US');
echo strcoll("Hello World!","Hello World!");
?>
Running instance »
Definition and Usage
strcoll () function compares two strings.
String comparisons will vary according to the local settings (A <a 或A> a).
Note: strcoll () is case-sensitive, but not binary-safe.
Note: If thecurrent local setting is C or POSIX, this function works with strcmp () the same.
grammar
strcoll( string1,string2 )
参数 | 描述 |
---|---|
string1 | 必需。规定要比较的第一个字符串。 |
string2 | 必需。规定要比较的第二个字符串。 |
technical details
return value: | This function returns:
|
---|---|
PHP version: | 4.0.5+ |
Update log: | Since PHP 4.2.3 onwards, this function works on win32. |
PHP String Reference