strcmp - 语法

strcmp(string1,string2)

它用于比较两个字符串

Sr.No 参数 & 描述
1

string1

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

2

string2

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

strcmp - 返回值

它返回字符串函数

strcmp - 示例

尝试以下示例

<?php
   echo "If this function returns 0, the two strings are equal.";
   echo "<br> The result is ";
   echo strcmp("Hello world!","Hello world!");
?>

这将产生以下输出-

If this function returns 0, the two strings are equal.
The result is 0

参考链接

https://www.learnfk.com/php/php-function-strcmp.html