Answers for "php compare strings case insensitive"

PHP
0

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";
}
Posted by: Guest on February-03-2022

Browse Popular Code Answers by Language