How to filter user submitted data easily in PHP?

Yesterday, I saw one of my friend was working on the the contact form and was filtering the user input data(posted variables) individually. He was using a function in PHP to filter the input and usingĀ  tedious approach while calling the filtering function for each variables with codingĀ  each of them in single line . […]