i would file($file) it, and test each line against a preg_replace..
like
//say $arr[0]="define('SPECIALS' , 'special.php');"
$rep_special_with="special101";
preg_replace("/special\\.php/i",$rep_special_with . ".php",$arr[0]);
// and rewrite the file
thats just a very basic way to do it, i havent actually thought about it in depth- thats the first thing that came to mind 🙂