Name
strnatcasecmp
Synopsis
int strnatcasecmp(stringone
, stringtwo
)
Compares two strings; returns a number less than 0 if
one
is less than
two
, 0 if the two strings are equal, and a
number greater than 0 if one
is greater
than two
. The comparison is
case-insensitive—that is,
“Alphabet” and
“alphabet” are not considered
equal. The function uses a “natural
order” algorithm—numbers in the strings are
compared more naturally than computers normally do. For example, the
values “1”,
“10”, and
“2” are sorted in that order by
strcmp( )
, but strnatcmp( )
orders them “1”,
“2”, and
“10”. This function is a
case-insensitive version of strnatcmp( )
.
Get Programming PHP now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.