dennismonsewicz Posted August 7, 2008 Share Posted August 7, 2008 How would I strip single quotation and double quotation marks? Link to comment https://forums.phpfreaks.com/topic/118693-stripping-quotes-from-post-info/ Share on other sites More sharing options...
discomatt Posted August 7, 2008 Share Posted August 7, 2008 $subject = str_replace( array("'", '"'), '', $subject ); Link to comment https://forums.phpfreaks.com/topic/118693-stripping-quotes-from-post-info/#findComment-611112 Share on other sites More sharing options...
dennismonsewicz Posted August 7, 2008 Author Share Posted August 7, 2008 and this will strip quotations from posted info from like a textarea? Link to comment https://forums.phpfreaks.com/topic/118693-stripping-quotes-from-post-info/#findComment-611115 Share on other sites More sharing options...
discomatt Posted August 7, 2008 Share Posted August 7, 2008 It will replace all instances of ' and " with an empty string... This doesn't take into account 'stylized' quotes outside of the ASCII range, but if you're trying to prevent injection it would work. Many prefer to replace them with backticks (`) or use mysql_real_escape_string as an alternative to completely removing them. Link to comment https://forums.phpfreaks.com/topic/118693-stripping-quotes-from-post-info/#findComment-611124 Share on other sites More sharing options...
dennismonsewicz Posted August 7, 2008 Author Share Posted August 7, 2008 alright thanks! Link to comment https://forums.phpfreaks.com/topic/118693-stripping-quotes-from-post-info/#findComment-611126 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.