Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php compare strings case insensitive

// Easiest way to check if two strings are the same regardless of case:
// Convert both to lowercase (or uppercase, your choice!) and compare them.

$foo="Hello There!";
$bar="HELLO THERE!";
if(strtolower($foo)===strtolower($bar)){
	echo "Strings are the same";
}
else{
	echo "Strings are different";
}
 
PREVIOUS NEXT
Tagged: #php #compare #strings #case #insensitive
ADD COMMENT
Topic
Name
4+2 =