For example, using my collation rules (Canadian-English), I obtain the following results: : strcmp « String « PHP






For example, using my collation rules (Canadian-English), I obtain the following results:

 
echo strcmp ('Apple', 'Banana');        // returns < 0
echo strcmp ('apple', 'Apple');        // returns > 0
echo strcmp ('1', 'test');                // returns < 0
  
  








Related examples in the same category

1.Comparing Strings
2.Comparing strings with strcmp()
3.strcmp() function performs a case-sensitive comparison of two strings.
4.int strcmp ( string str1, string str2 ), case-insensitive sibling, strcasecmp( )