国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

php strnatcmp()函數的用法總結

2024-05-04 23:19:46
字體:
來源:轉載
供稿:網友

Definition and Usage
定義和用法
The strnatcmp() function compares two strings using a "natural" algorithm.
strnatcmp()函數的作用是:用自然運算法則比較字符串(大小寫敏感)。

In a natural algorithm, the number 2 is less than the number 10. In computer sorting, 10 is less than 2, because the first number in "10" is less than 2.
在“自然運算法則”中,2比10小。在計算機序列當中,10比2小,因為“10”中的第一個數字是“1”,它小于2。

This function returns:
這個函數將返回下列值:

•0 - if the two strings are equal
0 – 如果字符串相等
•<0 - if string1 is less than string2
<0 – 如果string1小于string2
•>0 - if string1 is greater than string2
>0 – 如果string1大于string2
Syntax
語法

復制代碼 代碼如下:


strnatcmp(string1,string2)

Parameter參數Description描述

string1Required. Specifies the first string to compare
必要參數。指定參與比較的第一個字符串對象

string2Required. Specifies the second string to compare
必要參數。指定參數比較的第二個字符串對象

Tips and Notes
注意點
Note: The strnatcmp() is case-sensitive.
注意:strnatcmp()函數是區分大小寫的。

--------------------------------------------------------------------------------

Example
案例

復制代碼 代碼如下:


<?phpecho strnatcmp("2Hello world!","10Hello world!");echo "<br />";echo strnatcmp("10Hello world!","2Hello world!");?>


The output of the code above will be:
上述代碼將輸出下面的結果:-1 1

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 会理县| 平原县| 横山县| 乌恰县| 临汾市| 珠海市| 越西县| 金山区| 崇信县| 宿松县| 河源市| 永新县| 广东省| 墨玉县| 嵩明县| 衡阳县| 内黄县| 通州区| 景洪市| 定远县| 双峰县| 买车| 霞浦县| 拉孜县| 白山市| 陕西省| 额尔古纳市| 望城县| 保康县| 洪湖市| 乌鲁木齐市| 东辽县| 克什克腾旗| 韩城市| 黎川县| 镇康县| 五原县| 常熟市| 黄冈市| 阿瓦提县| 临武县|