Search Results
strnatcasecmp (PHP 4, PHP 5, PHP 7, PHP 8) strnatcasecmp — Case insensitive string comparisons using a "natural order" algorithm
Definition and Usage The strnatcasecmp () function compares two strings using a "natural" algorithm. 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. Note: The strnatcasecmp () is case-insensitive.
Jun 22, 2023 · The strnatcasecmp () function is a built-in function in PHP which compares this string using "natural order" algorithm. This function accepts two strings as parameter and returns an integer value (positive, negative or zero ).
Here're some more examples showing how strnatcasecmp() function actually works: The following example demonstrates the difference between the natural order algorithm and the regular computer string sorting algorithms using this function as comparison function.
- PHP 4+
PHP strnatcasecmp Function - Learn how to use the PHP strnatcasecmp function for case-insensitive string comparison using natural order. Explore examples and syntax.
The strnatcasecmp function performs a comparison of two strings case-insensitively, using a natural ordering algorithm (natural order). The first parameter passes the first string for comparison, the second - the second string.
strnatcasecmp Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8 Case insensitive string comparisons using a "natural order" algorithm
