无涯教程-PHP - strcoll函数

37 阅读1分钟

strcoll - 语法

int strcoll ( string $str1 , string $str2 )

它用于根据区域设置比较两个字符串

Sr.No 参数 & 描述
1

str1

它指定要比较的第一个字符串

2

str2

它指定要比较的第二个字符串

strcoll - 返回值

它返回字符串函数

strcoll - 示例

<?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

参考链接

www.learnfk.com/php/php-fun…