strip_tags_gf()
Convert HTML to readable plain text. Unlike a bare tag-strip, it turns paragraphs and list items into line breaks and bullets so the result stays readable.
Syntax
strip_tags_gf(value)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value |
string | yes | The HTML string. |
Returns
A plain-text string. Returns "" if the input isn't a string.
Example
$html = "<p>Hello</p><ul><li>One</li><li>Two</li></ul>";
$text = strip_tags_gf($html);
sys_log($text);
Example output
Hello
- One
- Two
Notes
</p>and<br>become newlines;<li>items become-bullets; becomes a space.- Useful for turning a rich-text field or fetched page into a plain-text email or log line.
See also: markdown_to_html(), url_get_contents()