- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
$comment = '
<!--This is a comment.
<!--This is a comment. Comments are not displayed in the browser--><!--This is a comment. Comments are not displayed in the browser-->
Comments are not displayed in the browser-->';
preg_match('/(\<!--\s*.*?((--\>)|$))/im', $comment, $matches);
var_dump($matches);