用新函数替换许多php文件中的弃用函数

I had used this function-----> import_request_variables('p') in more than 50 php files with this function --> extract($_GET, EXTR_PREFIX_ALL, 'p'); is there and php script can do this job without opening each file

I want something like this :

//read the entire string

$str=implode("",file('../*.php'));
$fp=fopen('../*.php','w');
//replace something in the file string, here i am replacing import_request_variables('p')  to extract($_GET, EXTR_PREFIX_ALL, 'p')
$str=str_replace('import_request_variables('p')','extract($_GET, EXTR_PREFIX_ALL, 'p')',$str);
//now, save the file
fwrite($fp,$str,strlen($str));

this code may help you!

 foreach (glob("path/to/files/*.php") as $filename)
    {
        $file = file_get_contents($filename);
        file_put_contents($filename, str_replace("import_request_variables('p')","extract($_GET, EXTR_PREFIX_ALL",$file));
    }