Also, one thing filter_var wont do is validate the domain. Which can be worked around with the following:
$email = '[email protected]'; $local = 'someone'; $domain = 'not-a-real-domain.com'; var_dump(filter_var($email, FILTER_VALIDATE_EMAIL) !== false); var_dump(checkdnsrr($domain, 'MX') !== false); var_dump(checkdnsrr($domain, 'A') !== false); David Neilsen | 07 834 3366 | PANmedia ® On Wed, Oct 12, 2011 at 3:03 PM, Chris Hope <[email protected]> wrote: > What makes you think that email address is not valid? > > Sure, a lot of email systems won't let you have a localpart like that, but > it's perfectly valid. > > Refer to http://en.wikipedia.org/wiki/Email_address#Syntax for a plain > English list of acceptable characters, and refer to the RFCs linked from > there if you want the sources themselves. > > > > On 12 October 2011 14:23, S.Mohammed Alsharaf <[email protected]>wrote: > >> I am just giving an example. filter_var can be acceptable but you cannot >> depend on it completely. The following is correct email address with >> filter_var! >> >> var_dump(filter_var('bo=&{b/@examp.com', FILTER_VALIDATE_EMAIL)); >> >> >> Cheers >> Mohammed >> >> ------------------------------ >> Date: Wed, 12 Oct 2011 12:04:09 +1100 >> From: [email protected] >> To: [email protected] >> Subject: Re: [phpug] Christchurch Final year Degree Student Seeking Advice >> re: PHP Frameworks >> >> >> I've always wondered about this... >> From 5.2 and up (and even 5.2 has been EOL'd), you have filter_var to >> validate emails for you. Why bother with an entire class (or regex if you're >> that way inclined) to do whats already in the PHP core? >> Especially applicable if you're developing it yourself rather than trying >> to support a wide range of platforms. >> >> Thanks, >> Stephen >> >> On 12/10/2011 12:01, S.Mohammed Alsharaf wrote: >> >> There are a lot to choose from! Many are good including Zend, Symfony, >> etc... But are they good for new developer in tight time final study project? >> I think no. >> >> You might find it easy to install these framework with the quick start >> sample, but then you will for sure find it hard to figure out how to do. >> (e.g. handle forms, authentication, session, filtering, etc...) I think you >> will waste your time learning how these frameworks works and do things. >> >> In my opinion you should avoid finding a framework for your project and >> use what you have learned from your course to build your project. Develop >> your code while keeping in mind the reasons for these frameworks and why >> they are good. >> >> - Think object oriented. >> - Don't mix html with PHP. >> - Re-use your code. >> - The simplest solution most of the time is the correct one! >> - Might be more reasons but cannot think of right now! :) >> >> Also, you can copy&paste code from these framework and re-use it in your >> code without having to rely completely on them. for example, you want email >> validation checkout the source code of Zend_Validate_EmailAddress. >> >> After you have finished your BICT learn one of these frameworks. I >> prefer Zend but Symfony 2 looks good too :) >> >> Comparison of web application frameworks from Wikipedia: >> http://en.wikipedia.org/wiki/Comparison_of_Web_application_frameworks#PHP_2 >> >> Hope this helps >> Mohammed >> >> Blog: http://jamandcheese-on-phptoast.com/ >> Email: [email protected] >> >> > Date: Tue, 11 Oct 2011 16:10:49 -0700 >> > Subject: [phpug] Christchurch Final year Degree Student Seeking Advice >> re: PHP Frameworks >> > From: [email protected] >> > To: [email protected] >> > >> > Hello all, I am a student at CPIT in my last semester of a BICT >> > specialising in web development. Currently in the process of >> > completing my final year project developing a licencing system based >> > around php. >> > I find myself in the position of choosing and evaluating which >> > framework I should use, as I consider myself a novice I feel it would >> > be best for me to pose this question to you all for some expert >> > advice. Most suitable would be a frame work that is comprehensive yet >> > can be picked up easily to someone with a limited understanding quite >> > quickly, as this project is running on a tight time schedule. >> > I would really appreciate any help and advice you can all offer. >> > >> > -- >> > NZ PHP Users Group: http://groups.google.com/group/nzphpug >> > To post, send email to [email protected] >> > To unsubscribe, send email to >> > [email protected] >> -- >> NZ PHP Users Group: http://groups.google.com/group/nzphpug >> To post, send email to [email protected] >> To unsubscribe, send email to >> [email protected] >> >> >> >> -- >> NZ PHP Users Group: http://groups.google.com/group/nzphpug >> To post, send email to [email protected] >> To unsubscribe, send email to >> [email protected] >> >> -- >> NZ PHP Users Group: http://groups.google.com/group/nzphpug >> To post, send email to [email protected] >> To unsubscribe, send email to >> [email protected] >> > > > > -- > Chris Hope > iSavvy Ltd > > Email: [email protected] > Blog: www.electrictoolbox.com > Phone: +64 9 522 9531 > Mobile: +64 21 866 529 > > -- > NZ PHP Users Group: http://groups.google.com/group/nzphpug > To post, send email to [email protected] > To unsubscribe, send email to > [email protected] > -- NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected]
