a:active, a:hover {
color: #7DA7D9;
text-decoration: underline;
}
<snip>
span.link {
color: #e7e7e7;
}
<a href='whatever'><span class='link'>Some text</span></a>
<?php
$filename = "index.inc";
$handle = fopen ($filename, "rb");
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
$html = preg_replace("'<a([^>]+)>(.*)</a>'Usi", "<a$1><span class='link'>$2</span></a>", $contents);
echo $html;
?>
<head>
<title>Untitled</title>
<style TYPE="text/css">
a:active, a:hover {
color: red;
text-decoration: underline;
}
span.link {
color: blue;
}
</style>
</head>