Code refactoring is a programming technique that involves rewriting code in a way that improves its readability or simplifies its structure without changing its results. Thus refactoring is mainly about improving code maintainability. Code smells is a term coined by Kent Beck, and refers to certain attributes of written code that suggest it should be refactored. Continue reading The Advancing PHP Developer Part 3: Refactoring
A question that I hear often is how can one evolve as a PHP developer? The answer varies and depends on the person’s programming knowledge and experience. I will cover the topics I think are the most important briefly in this series, provide links and maybe expand on them in the future. Continue reading The Advancing PHP Developer Part 1: Coding Standards
Continuing with this series, we’ll get right to business.
Filtering and validation
Filtering and validation are the basics of dealing with user input in the web. We filter data before passing it to the database to prevent attacks (such as SQL Injections) and we validate user input to make sure it is what we expect it to be (hence, valid).
I will be using the Zend_Filter and Zend_Validate components to deal with those two tasks, and combine their usage via the Zend_Filter_Input component. Zend_Filter and Zend_Validate are self explanatory, however I will cover Zend_Filter_Input in brief.