fraser5002 Posted February 28, 2011 Share Posted February 28, 2011 Hi, How would i strip out both the " and ' characters from a php string? Thanks Fraser Link to comment https://forums.phpfreaks.com/topic/229172-remove-from-string/ Share on other sites More sharing options...
SaMike Posted February 28, 2011 Share Posted February 28, 2011 $newString = preg_replace("/\'\"", null, $oldString) Link to comment https://forums.phpfreaks.com/topic/229172-remove-from-string/#findComment-1180949 Share on other sites More sharing options...
kenrbnsn Posted February 28, 2011 Share Posted February 28, 2011 I'd use str_replace() <?php $str = "this string has both single quotes ' and double quotes " . '" in it'; $str = str_replace(array('"',"'"),'',$str); echo $str; ?> Ken Link to comment https://forums.phpfreaks.com/topic/229172-remove-from-string/#findComment-1180956 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.