strcasecmp() is a nice PHP function for comparing two strings case-insensitively.
Note: the function returns 0
if they are equal.
Examples
The examples below both return the string true
.
<?php
$var1 = "Hello";
$var2 = "hello";
if ( strcasecmp( $var1, $var2 ) == 0 ) {
echo 'true';
}
else {
echo 'false';
}
<?php
$var1 = "lOVe";
$var2 = "love";
if ( strcasecmp( $var1, $var2 ) == 0 ) {
echo 'true';
}
else {
echo 'false';
}
Grab?