Xoá comment = Regular Expression

Posted by admin | Posted in Biểu thức chính quy | Posted on 16-08-2007

Xoá HTML Comment


preg_replace('/<!--(.|\s)*?-->/', '', $buffer);

Xoá PHP Comment


$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!’, ”, $buffer);

Share This Post

Write a comment

Viet Nam PHP Blog Rss