Say I\'ve got a file test.php in foo directory as well as bar. How can I replace bar/test.php with foo/test.php
test.php
foo
bar
bar/test.php
foo/test.php
You can use both rename() and copy().
I tend to prefer to use rename if I no longer require the source file to stay in its location.