php remove all classes from html string code example Example: php remove class attribute $html = preg_replace('/class=".*?"/', '', $html);