PHP - strcoll 函式



語法

int strcoll ( string $str1 , string $str2 )

定義和用法

用於根據區域設定比較兩個字串。

返回值

返回字串函式。

引數

序號 引數及描述
1

string1

指定要比較的第一個字串。

2

string2

指定要比較的第二個字串。

示例

嘗試以下示例

<?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!");
?>

這將產生以下結果:

If this function returns 0, the two strings are equal.
The result is 0
php_function_reference.htm
廣告