PHP – Strip Special Characters From Text

The following php example helps you to strip the special characters and return only what is required
and very useful in search queries to avoid XSS injections.

Code Example:

$text = 'this>! is %#4>sample* file 01.jpg<script>';
$output = preg_replace('/[^a-zA-Z\s0-9\.]/', '', $text);
echo $output;

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail