PHP function strnatcmp()

Availability in PHP 4.0

String comparisons using a "natural order" algorithm

Parameters

Parameter Data type Default value Note
$str1 string not The first string.
$str2 string not The second string.

Return values

int

Similar to other string comparison functions, this one returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.

Other resources

Official strnatcmp documentation

Newsletter

Nejlepsi tipy a triky o PHP do Vaseho e-mailu. Clanky a novinky nejen ze sveta PHP a programovani.