PHP strcasecmp() Function
Definition
This is a case-insensitive version of the strcmp()
.
Syntax
PHP strcasecmp() Function has the following syntax.
int strcasecmp ( string str1, string str2 )
Parameter
str1
and str2
are the two string values we will compare.
Return
PHP strcmp() Function returns
- -1 if word one comes alphabetically before word two,
- 1 if word one comes alphabetically after word two, or
- 0 if word one and word two are the same.
Example
case-insensitive string value compare
<?PHP
$result = strcasecmp("Hello", "hello");
?>