I have a table column that contains a list of items separated by "br" tag(no new lines).
I fetch this data and convert br tags to new lines like as defined below.
$nlformat = str_replace("<br>","\n",$mem['mem_services']);
I'm also writing a file in this php script that will turn this list into an html list with "li" tags. This is easy, BUT if the list has two consecutive new lines "\n\n" I want to end the first list and create a second list like so...
<ul>
<li>item</li>
<li>item</li>
<li>item</li>
</ul>
<ul>
<li>item</li>
<li>item</li>
<li>item</li>
</ul>
I'm having an issue identifying 2 consecutive new lines in the following variable. Below is just one of many examples from other answered questions on this site. None of them work
$newul = preg_replace("/\r\n\r\n|\n\n|\r\r/", "</li></ul><ul><li>", $nlformat);
Does anyone know why. Maybe it has something to do with the $nlformat variable.
With the current example I get no change to $nlformat i.e.
item
item
item
item
item
item