Jump to content

My Compare Function, It too simple, I don't see the error.


Lamez

Recommended Posts

I'm more or less getting a logic error, so I cannot provide any syntactical errors.

 

The function in question is suppose to take two variables and compare them. I also have a boolean variable to see if I care about the case of the variables. However if I do something like this:

 

compare("NAME", "name", false);

The function returns false.

 

Here is the function:

function compare($var1, $var2, $caseMatters){
if(!$caseMatters && !is_numeric($var1) && !is_numeric($var2)){
	strtolower($var1);
	strtolower($var2);
}
return md5($var1) === md5($var2);
}

 

Any thoughts?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.