public static function strip_all_tags($string, $remove_breaks = false)
    {
        $string = preg_replace('@<(script|style)[^>]*?>.*?</\\1>@si', '', $string);
        $string = strip_tags($string);

        if ($remove_breaks) {
            $string = preg_replace('/[\r\n\t ]+/', ' ', $string);
        }

        return trim($string);
    }
public static function strip_all_tags($string, $remove_breaks = false)
    {
        $string = preg_replace('@<(script|style)[^>]*?>.*?</\\1>@si', '', $string);
        $string = strip_tags($string);

        if ($remove_breaks) {
            $string = preg_replace('/[\r\n\t ]+/', ' ', $string);
        }

        return trim($string);
    }
public static function strip_all_tags ( $ string , $ remove_breaks = false ) { $ string = preg_replace ( '@<(script|style)[^>]*?>.*?</\\1>@si' , '' , $ string ) ; $ string = strip_tags ( $ string ) ; if ( $ remove_breaks ) { $ string = preg_replace ( '/[\r\n\t ]+/' , ' ' , $ string ) ; } return trim ( $ string ) ; }
Properly strip all HTML tags including script and style.

Credit: http://core.svn.wordpress.org/trunk/wp-includes/formatting.php

@param   string
@param   bool

@return  string
Properly strip all HTML tags including script and style .