strip html tags from data stored by users in html
<p>i am working on project, in main page we display users detail and every user update its detail him self and we also allow HTML tags in detail.</p>

<p>but the problem what i am facing is, if person add some HTML detail like</p>

<pre><code>&lt;p&gt;&lt;span style="color:#4c4c4c;font-family:Verdana;"&gt;Graphic Designer. Contact ***** .&lt;/span&gt;&lt;/p&gt;
</code></pre>

<p>but on index page we display few character of detail and it comes to main page like this</p>

<pre><code>&lt;p&gt;&lt;span style="color:#4c4c4c;font-family:Verda
</code></pre>

<p>this disturb all structure of main page.</p>

<p>i have tried PHP function</p>

<pre><code>strip_tags
</code></pre>

<p>this did't work for me and i also write my own function to strip these tags on main page</p>

<pre><code>function strip_html_tags( $text )
{
    $text = preg_replace(
        array(
          // Remove invisible content
            '@&lt;head[^&gt;]*?&gt;.*?&lt;/head&gt;@siu',
            '@&lt;style[^&gt;]*?&gt;.*?&lt;/style&gt;@siu',
            '@&lt;script[^&gt;]*?.*?&lt;/script&gt;@siu',
            '@&lt;object[^&gt;]*?.*?&lt;/object&gt;@siu',
            '@&lt;embed[^&gt;]*?.*?&lt;/embed&gt;@siu',
            '@&lt;applet[^&gt;]*?.*?&lt;/applet&gt;@siu',
            '@&lt;noframes[^&gt;]*?.*?&lt;/noframes&gt;@siu',
            '@&lt;noscript[^&gt;]*?.*?&lt;/noscript&gt;@siu',
            '@&lt;noembed[^&gt;]*?.*?&lt;/noembed&gt;@siu',

            '@&lt;/?((address)|(blockquote)|(center)|(del))@iu',
            '@&lt;/?((div)|(h[1-9])|(ins)|(isindex)|(p)|(pre))@iu',
            '@&lt;/?((dir)|(dl)|(dt)|(dd)|(li)|(menu)|(ol)|(ul))@iu',
            '@&lt;/?((table)|(th)|(td)|(caption))@iu',
            '@&lt;/?((form)|(button)|(fieldset)|(legend)|(input))@iu',
            '@&lt;/?((label)|(select)|(optgroup)|(option)|(textarea))@iu',
            '@&lt;/?((frameset)|(frame)|(iframe))@iu',
        ),
        array(
            ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',"$0", "$0", "$0", "$0", "$0", "$0","$0", "$0",), $text );


    return strip_tags( $text);
}
</code></pre>

<p>this also did't work.</p>

<p>what i need is: to strip all html tags for proper display on main page.</p>

<p>Thanks</p>
