views:

194

answers:

2

php, whats is the different between strtolower and mb_strtolower?

If i want to convert submitted email address, to be converted to lower-case, which one should i use? Is there any email like this : [email protected]

If there are such email, should i still convert the submitted email address to lower case?

+1  A: 

The mb_ functions work with Multi-Byte (unicode) strings as well. E-Mail addresses shouldn't be case sensitive - there isn't much reason to convert them to lower.

gnarf
According to about.com, the "local address" *is* case sensitive, with regards to RFC 2821 (whether or not MTAs treat it that way in practice is another question entirely), while domains are case insensitive. see: http://email.about.com/od/emailbehindthescenes/f/email_case_sens.htm As such, best practice is to leave case intact on any address you're planning on using. Converting to lower case for comparison/assessing uniqueness probably makes sense, though.
Frank Farmer
+1  A: 

whats is the different between strtolower and mb_strtolower?

The mb_* functions work with multi-byte string. The manual says:

By contrast to strtolower(), 'alphabetic' is determined by the Unicode character properties. Thus the behaviour of this function is not affected by locale settings and it can convert any characters that have 'alphabetic' property, such as A-umlaut (Ä).

-

Is there any email like this : [email protected]

Yes, I suppose there could be email addresses like that. I've found that in general, email addresses are case-insensitive, so I don't bother changing their case.

nickf
i got an email : [email protected] server cant send email to him. Email sending is auto-generated
Domains are case-insensitive. Sending to GoOgLE.com should work just as well as sending to google.com, in theory.
Frank Farmer