Definition and usage
The strnatcasecmp() function compares two strings using a "natural" algorithm.
In a natural algorithm, the number of people on No. 2 is less than 10. In computer sorting, 10 is less than 2 because the first number "10" is less than 2.
This function returns:
0 - if the two strings are equal
"0 - if string is less than string
"0 - if string is greater than string
Grammar
strnatcasecmp(string1,string2)
Parameter description string: required. The first string specified is compared string2: required. Specify the second string comparison and see the example.
echo strnatcasecmp("2Hello world!","10Hello world!");
echo "
";
echo strnatcasecmp("10Hello world!","2Hello world!");
?>
The output is 1-1