Xóa comment trong html, đếm số thẻ tag trong html

// Remove unwanted HTML comments function remove_html_comments($content = '') { return preg_replace('/<!--(.|\s)*?-->/', '', $content); } //get count tag in html function getCountTagInHtml($content,$tag) { $c = 0; if(trim($content)!=""){ try { $dom = new DOMDocument; $dom->loadHTML($content); $c = $dom->getElementsByTagName($tag)->length; } catch (Exception $exc) { } } return $c; }

Copyright © 2017. Powered by WordPress & Romangie Theme.