Re: Simple script but confusion with comparing strings

From: Date: Sun, 01 Feb 2004 00:13:32 +0000
Subject: Re: Simple script but confusion with comparing strings
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176480@lists.php.net to get a copy of this message
Ryan A wrote:
$somecontent = strtoupper(md5($type));
compared to...
if(strcmp($contents,md5("1"))==0)
Comparing uppercase to lowercase (md5 generates a lowercase string). Either remove the strtoupper when first generated, strtoupper the md5 result in the comparison or use strcasecmp instead of strcmp. -- Stuart

« previous php.general (#176480) next »