jaxdevil Posted May 26, 2008 Share Posted May 26, 2008 I have a code that is stripping all HTML markup away from a database field before outputting it, but there are still ASCII character markups left like: ™ I tried using preg_replace but I must be doing it wrong because it is not removing anything. Here is the code, can you tell me what I am doing wrong? $description = $row['description']; $details = $row['details']; $description = strip_tags($description); $details = strip_tags($details); $pattern = '&#*;'; $replacement = ''; $description = preg_replace($pattern, $replacement, $description); $details = preg_replace($pattern, $replacement, $details); Link to comment https://forums.phpfreaks.com/topic/107273-solved-removing-ascii-code-from-query/ Share on other sites More sharing options...
sasa Posted May 26, 2008 Share Posted May 26, 2008 try <?php $a = 'sasa xxx'; echo $a,"<br />\n"; $a = preg_replace('/[^;]+;/','',$a); echo $a; ?> Link to comment https://forums.phpfreaks.com/topic/107273-solved-removing-ascii-code-from-query/#findComment-550047 Share on other sites More sharing options...
jaxdevil Posted May 26, 2008 Author Share Posted May 26, 2008 Works like gang busters! Thanks a million man! Link to comment https://forums.phpfreaks.com/topic/107273-solved-removing-ascii-code-from-query/#findComment-550048 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.