strip_formatting — Strip HTML tags from a string.

Text-related functions

Summary

strip_formatting($str, $allowableTags = '', $fallbackStr = '')

Strip HTML tags from a string.

This is essentially a wrapper around PHP’s strip_tags() function, with the added benefit of returning a fallback string in case the resulting stripped string is empty or contains only whitespace.

Parameters:
  • $str (string) – The string to be stripped of HTML formatting.

  • $allowableTags (string) – The string of tags to allow when stripping tags.

  • $fallbackStr (string) – The string to be used as a fallback.

Returns:

The stripped string.

Usage

Examples

See Also