Tuesday, 12 March 2019

How to SANITIZE AND VALIDATION in PHP?

In SANITIZE string we can remove extra tag like <p>, <h1> ect..Example are give below..


<?php // Sample user comment $message = "<p>This is Test Message..</p>"; // Sanitize and print comment string $sanitizedComment = filter_var($message, FILTER_SANITIZE_STRING); echo $sanitizedComment; ?>