The question is extremely easy, but the solution might not.
Let’s say this is my text input inside a variable called $description:
<p>
text text text
text text text
</p>
<ul>
text text
text text
text text
</ul>
<p>
text text text
text text text
</p>
I believe it’s already obvious what I need to do. I need to locate all <ul></ul> tags inside my string and add <li></li> tags for each entry inside, under these conditions:
- I don’t know how many
<ul></ul>tags there might be in total, the function should find all of them - All list-entries inside each
<ul></ul>WILL be separated by enter (\r\n)
Any ideas?
This will do the job:
Edit: first edition worked only with “\n” – now it works with “\n” and “\r\n”