Definition and Usage
Definition and Usage
The strnatcmp() function compares two strings using a "natural" algorithm. Rules compare strings (case sensitive).
In "natural algorithm" Medium, 2 is smaller than 10. In the computer sequence, 10 is smaller than 2 because the first number in "10" is "1", which is smaller than 2.
This function will return the following values:
0 - if the strings are equal
•<0 - if string1 is less than string2
<0 - if string1 is less than string2
• >0 - if string1 is greater than string2
>0 - if string1 is greater than string2
Syntax
Syntax
Parameter parameter | Description | ||||||
---|---|---|---|---|---|---|---|
string1 | Required. Specifies the first string to compareRequired parameter. Specify the first string object to be compared | ||||||
string2 | Required. Specifies the second string to compare
|
Tips and Notes
Notes
Note: The strnatcmp() is case-sensitive.
Note: The strnatcmp() function is case-sensitive.
-------------------------------------------------- ----------------------------------
Example
Case