PHP - strcmp 函式



語法

strcmp(string1,string2)

定義和用法

用於比較兩個字串

返回值

返回字串函式

引數

序號 引數和描述
1

string1

指定要比較的第一個字串

2

string2

指定要比較的第二個字串

示例

嘗試以下示例

<?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
php_function_reference.htm
廣告