What PHP function can be used to remove HTML tags from a string?

When working with user-generated content or data from external sources, it's important to sanitize input to prevent potential security risks such as XSS attacks. One common task is to remove HTML tags from a string to ensure that only plain text is displayed. In PHP, you can achieve this using the `strip_tags()` function, which removes all HTML and PHP tags from a string.

// Input string with HTML tags
$input = "<p>This is a <strong>sample</strong> text with <a href='#'>HTML</a> tags.";

// Remove HTML tags from the input string
$cleanedString = strip_tags($input);

echo $cleanedString;