Comparison

The string comparison functions are:
   strcmp($s1,$s2)
strcasecmp($s1,$s2)
strncmp($s1,$s2,$i)
strncasecmp($s1,$s2,$i)
strnatcmp($s1,$s2)
strnatcasecmp($s1,$s2)
strcoll($s1,$s2)
substr_compare($s1,$s2,$i1[,$i2[,$b]])

These functions return <0 if $s1 is less than $s2, >0 if $s1 is greater than $s2, and 0 if they are equal. ‘case’ performs a case-insensitive comparison. ‘n’ compares the first $i characters from each string. ‘nat’ performs a ‘natural order’ comparison. strcoll(……) is similar to strcmp(……) except that the comparison is not binary safe, and is locale based. substr_ compare(……) compares $s1 from position $i1 with $s2 up to $i2 characters. If $i1 is negative, it starts counting from the end. If $b is true, the comparison is case-insensitive.

RESETRUNFULL
<!DOCTYPE html><html><head></head>
<body><?php

echo strcmp("abc","abd");  // -1
echo strcasecmp("abc","ABC");  // 0
echo strncmp("abcd","abce",3);  // 0
echo strncasecmp("aBcD","AbcE",3);  // 0
echo strnatcmp("image2","image11");  // -1
echo strcmp("imAgE11","iMage2");  // 1
echo strcoll("abc","abcd");  // -1
echo substr_compare("abcdef","cDE",2,3,true); // 0

?></body></html>