Jump to content

Preg Replace Problem maybe with _


jaxdevil

Recommended Posts

I am trying to replace the character underscore ( _ ) with a space. It is not working, it is making the whole string blank. Any thing I am doing wrong?

 

<?
$string = $row['subcat'];
$replacement = ' ';
$pattern = '_';
echo preg_replace($pattern, $replacement, $string);
?>

Link to comment
https://forums.phpfreaks.com/topic/111280-preg-replace-problem-maybe-with-_/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.