Try this one:
<?php
$file = "file3.html";
$html= fopen($file,"r");
$content = fread($html,filesize($file));
preg_match_all ("/<a(.)>(.<\/a>)/", $content, $matches);
for ($i=0; $i< count($matches[0]); $i++) {
echo "matched: ".$matches[0][$i]."\n<br>";
}
?>