September 2001
Intermediate to advanced
768 pages
32h 45m
English
int strnatcmp(string string_one, string string_two)
Compares strings using a “natural” algorithm.
Returns:
Integer
Description:
strnatcmp() compares strings in much the same fashion as a human would. Numbers are ordered by their value, instead of by their character value.
Version:
PHP 4.0RC2+
See also:
To perform non-case-sensitive natural string comparison:
strnatcasecmp()
For additional information on natural sorting:
Martin Pool’s Natural Order String Comparison
www.linuxcare.com.au/projects/natsort/
Example:
<?php $strings = array ("one", 1, "01", 2001, "two-thousand and one"); foreach ($strings as $string_one) { foreach ($strings as $string_two) { $comparison = strnatcmp ($string_one, $string_two); ... |
Read now
Unlock full access