一半君的总结纸

听话只听一半君

#79 How do I perform a case-insensitive string comparison?

Wrap both strings with either “tolower()” or “toupper()” within the comparison:

string $a = "WindowsNT";
string $b = "windowsnt";

print ( $a == $b );
// Result: 0 //

print ( tolower( $a ) == tolower( $b ) );
// Result: 1 //

print ( toupper( $a ) == toupper( $b ) );
// Result: 1 //

13 January 2002

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: