Validating and Sanitizing input in PHP?

Explain the difference between Validating and Sanitizing input in PHP?
Validating Input:
These filters are used to check the accuracy of the input. Strict rules are applied for formatting. eg Email validating.
It Ensures that no garbage data gets input and also ensures that the needed info is fetched before any processing is done.

Sanitizing Input:
These filter the input to remove any stray characters in them. This is very effective to remove special characters or stuff.
Sanitizing is also important like Validating input.


Post a Comment