mcaskill/php-strip-html

Strip HTML and PHP tags from a string.

1.0.0 2017-11-24 13:47 UTC

This package is not auto-updated.

Last update: 2024-04-19 18:10:55 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.