Answer the question
In order to leave comments, you need to log in
How to extract all bare text from HTML using PHP?
At the input, HTML code with a bunch of tags and texts between them, there can also be tags inside the text.
The task is to get an array of strings with pieces of text without tags.
For example, if in HTML such code
<div>Здесь какой то текст <a href="#">А здесь ссылка</a> а дальше еще какой то текст</div>
Answer the question
In order to leave comments, you need to log in
$content=preg_replace('/<[^>]+>/', '', $content);
preg_match('/(?!<[^>]+>)/', $content); //собрать все строки в массив
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question