Straight, simple and to the point. Nice. Missing test and QA tools though. Probably an oversight, since the author does suggest following Derick Rethans and Sebastian Bergmann. And another one: read up on the SPL library before you start re-inventing that wheel.
All good points. If you'd like to submit a pull request, I'll be happy to credit you with the additions and get them added to the site.
PHP: The Right Way
31–40 of 233 posts
Re: PHP: The Right Way
#32I like the general idea of this, but think that it is nearly useless in its current form. It's way too superficial. To teach newbies how to do things right it doesn't suffice to link to a few resources and hope that they'll read them (hint: they won't). Instead one needs more concrete code examples, etc. Which would obviously be too much for one page :)
I agree. It's very much in a v1.0 form right now. Once I move over to GitHub Pages, I hope to add more links to tutorials and code samples without bloating the document itself.
Re: PHP: The Right Way
#33Re: PHP: The Right Way
#34Re: PHP: The Right Way
#35Earlier quoted context omitted.
SQL injection attacks alone are almost always a result of not filtering input...
With parametrized queries, that becomes a non-issue, but I still see no point in cluttering the database with data that's just going to be filtered out at some point - might as well filter it before it goes into the DB to begin with. The exception, of course, being those rare cases when some users need to see the filtered data and others need to see the raw data, but even then, you likely won't want to allow everythi…
Re: PHP: The Right Way
#36One point in and its already dead wrong, you never filter input, only output. Edit: Everyone talking about databases: paramaterized queries, check them out.
SQL injection attacks alone are almost always a result of not filtering input...
Re: PHP: The Right Way
#37Something to consider mentioning - there are some in PHP these days that take this sort of stuff a bit too far. Drives me nuts to see people writing classes to encapsulate a 3 column database result. So much overhead and boilerplate.
Re: PHP: The Right Way
#38These guidelines won't save you from some bullshit PHP "rules", such as: http://stackoverflow.com/questions/5810168/php-foreach-by-re...
Re: PHP: The Right Way
#39One point in and its already dead wrong, you never filter input, only output. Edit: Everyone talking about databases: paramaterized queries, check them out.
These functions should be used to "validate" input rather than "filter" it.
Re: PHP: The Right Way
#40is creepy. Never ever run other people's code without at least giving it a glance.