I have a string which contains a lot of HTML (HTML email body).
What I want to do is lose all the HTML but keep the line breaks, I tried strip_tags()
but this didn't work out for me, it makes the string just 1 line.
After this has been done, I want to echo only the first 5 lines from this string.
Anyone got an idea?
Update:
$string = strip_tags($string, '<p><br><br />');
Seems to be working, now I have to select the first 5 lines from the string, anyone an idea?
Update: Array keeps giving a few empty values. I managed to remove the empty ones but the array doesn't restart the counting. Array looks like this now:
Array ( [8] =>
Dit is een nieuwe test met meerdere regels.
[9] =>
Dit is regel nummer 2.
[10] =>
Dit is regel nummer 3.
But it should start counting at 0 again.
array_filter() array_merge()
etc. do not work.