You could use the copy()
function :
// Will copy foo/test.php to bar/test.php
// overwritting it if necessary
copy('foo/test.php', 'bar/test.php');
Quoting a couple of relevant sentences from its manual page :
Makes a copy of the file source to
dest.
If the destination
file already exists, it will be
overwritten.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…