PHP mengubah ekstensi file

$newExtension = 'txt';
$info = pathinfo($filename);
$filename = $info['dirname']."/".$info['filename'].'.'.$newExtension;
TomatenTim