Thursday, July 29, 2010

Removing special characters from a string using php

$str = '"!@#$%^&*()MyTest\'_+-|/\/{}[];:<,>.?';
$tempVar = preg_replace('/[^a-zA-Z0-9]*/','',$str);
echo $tempVar;

No comments:

Post a Comment