The PHP Function StrutcaseCmp
When comparing strings, the case of the characters that make up those strings is taken into consideration. This can lead to a difference in results when using comparison methods. PHP provides a number of functions that compare strings disregarding their case. One of these is the strnatcasecmp function. This function compares two strings using a "natural order" algorithm. It returns a negative value if string1 is less than string2, a positive value if string1 is greater than string2, or 0 if both strings are equal.
A function is a block of code that can be called at any time. It is different from a constant, which is set once and used throughout the script. PHP also offers arrays, which are used to store several values together and access them in a more efficient way.
The php function strnatcasecmp compares two strings using the natural order algorithm. It is similar to the strcmp function, except that it is case-insensitive.
The function takes as its first parameter the name of the string that is to be compared with the second. As with other string comparison functions, the return value is either a negative value if str1 is less than str2, a positive value if str1 is greater than str2, or 0 if both strings are identical. The strnatcasecmp() function is part of the standard PHP library. Its function prototype is available on the See Also section of the strnatcasecmp() man page.