Changes between Version 2 and Version 3 of Ticket #57375, comment 2
- Timestamp:
- 12/23/2022 12:00:55 AM (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #57375, comment 2
v2 v3 18 18 `rename()`, on the other hand, simply updates the ''metadata''. This makes `rename()` significantly more performant. It is purpose-built for moving files and directories. 19 19 20 Upon failure, falling back to `copy_dir()` is the appropriate behaviour. 21 20 22 == PHP's `rename()` under the hood 21 23 As mentioned above, `rename()` updates the ''metadata''. However, when PHP's `rename( $from, $to )` is called with `$from` and `$to` on different drives, it uses a recursive copy. For anyone who has ever dragged and dropped a file/directory from one drive to another, you'll likely have noticed that this makes a copy on the second drive. This isn't a negative, but just a bit of extra information on how `rename()` handles this scenario for those interested.