How to remove html tags from a string in php?

This example is focused on how to remove html tags from a string in php. You can removes HTML tags using strip_tags() method.

1. Code:

<?php
//declaring a string with html tags
$html_string="Welcome <span>to</span> <b>Soltuts.com</b>";

//display the sting without any html tags
echo strip_tags($html_string);
?>

2. Example:

Input:

input: "Welcome <span>to</span> <b>Soltuts.com</b>";

Output:

Welcome to Soltuts.com