I would like to create a function that looks for a name of an attorney within a string and if it finds the name then the function will automatically link it.

I think the following example makes it clear what I am trying to do.

PHP Code:
$attorney_array = array(1=>'Michael Anderson'2=>'Tom A. Atkinson'3=>'Pat M. Boyer');

$text '<p>Pat M. Boyer started her career as an audiologist in 1981, and has worked in that capacity in major medical centers in the Cleveland area as well as at the university level.</p>';

function 
parse_attorney_bio($text$attorney_array){

}

echo 
$text parse_attorney_bio($text$attorney_array);

// Output
<p><a href="bio.php?id=3">Pat MBoyer</astarted her career as an audiologist in 1981, and has worked in that capacity in major medical centers in the Cleveland area as well as at the university level.</p>'; 
Can anyone lead me to some tutorials or give me some tips on how to write such a function?

Thanks!