English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP String String Function Manual
The strcoll() function compares strings based on the locale.
int strcoll(string $str1 , string $str2 )
It is used to compare two strings based on the language environment.
Since PHP 4.2.3 starting, this function can be used in win32 is working.
If str1 Less than str2 Returns < 0; if str1 Greater than str2 Returns > 0; if both are equal, returns 0.
Serial Number | Parameters and Description |
---|---|
1 | str1 It specifies the first string to be compared |
2 | str2 It specifies the second string to be compared |
Try the following example to compare strings:
<?php echo "If this function returns 0, the two strings are equal."; echo "<br> The result is "; setlocale(LC_COLLATE, 'NL'); echo strcoll("Hello World!", "Hello World!"); ?>Test and see‹/›
Output Result
If this function returns 0, the two strings are equal. The result is 0