mcaskill/php-strip-html

Strip HTML and PHP tags from a string.

Maintainers

Package info

gist.github.com/mcaskill/db368cc7971763fa3ec40f0da252f608

pkg:composer/mcaskill/php-strip-html

Statistics

Installs: 45 550

Dependents: 0

Suggesters: 0

1.0.0 2017-11-24 13:47 UTC

This package is not auto-updated.

Last update: 2026-03-07 02:57:31 UTC


README

(PHP 5 >= 5.4)
strip_html — Strip HTML and PHP tags from a string.

Description

string strip_html( string $str )

This function tries to return a string with all NULL bytes, HTML and PHP tags stripped from a given str. Unlike strip_tags(), this function is mindful of line-breaks and metadata elements (e.g., <style>).

This function is useful for converting a HTML-rich string into a plain-text string for emails.

Parameters

  • str — The input string.

Return Values

Returns the stripped string.

Installation

With Composer

$ composer require mcaskill/php-strip-html

Without Composer

Why are you not using composer? Download Function.Strip-HTML.php from the gist and save the file into your project path somewhere.