How can I strip punctuation except for these characters .
=
$
\'
-
€
%
$whatToStrip = array("?","!",",",";"); // Add what you want to strip in this array
$test = "Hi! Am I here?";
echo $test."\n\n";
echo str_replace($whatToStrip, "", $test);
Demo here
or, of course, shorter :
$test = str_replace(array("?","!",",",";"), "", $test);
Source from 1st example of str_replace manual