PHP - Extracting text from HTML

html, php

Solution

If you want to extract all text within any tags, the simple way is to strip the tags: strip_tags()

If you want to remove specific tags, maybe this SO questions helps.

Problem

I have a long string of HTML that contains ``` <p> <img> <span> ``` and a bunch of other tags. Is there anyway of extracting ONLY the text within the tags from this string?

Original source