<?php
$link_pattern = "/(<a href=\"[a-zA-Z0-9\.\/_-]*\" [a-zA-Z0-9.\"\.]*?>)/";
preg_match($link_pattern, $contents, $links);
foreach($links as $link)
{
$contents = str_replace($link, '', $contents);
}
$contents = str_replace('</a>', '', $contents);
?>
The pattern may need some tweaking, but that's pretty much the gist of it. Set up a pattern to look for any link and grab all the links to an array. Then just loop through the array and using str_replace() replace the link with nothing (''). Then just clean it up by replacing all the "</a>" since there won't be any links.
~Brett