I am using PHPExcel to extract data from my database onto an organized Excel sheet. Everything is working great except for one thing. My database entries can sometimes contain HTML markups like <strong></strong>, <BR>, <p></p> etc ... So I managed to get this PHP line working, this is working great to replace my <BR> markups to a space.
$data = str_replace("<br />", "\n", $data);
$data = str_replace("<br/>", "\n", $data);
$data = str_replace("<br>", "\n", $data);
However when I try doing the following it does nothing. I was expecting that it would bold the text.
$data = str_replace("<strong>", '&B', $data);
I read on these forums that its best to use preg_replace and setup an array for all the HTML markups I need replaced. For the life of me I can't understand how to use preg_replace. Would someone please give me some advise what is the best way to replace markups such as <strong> and </strong> to bold when it exports, this would be very much appreciated.