Re: difference between copy and strem_copy
| From: | Christoph Becker | Date: | Wed, 01 Oct 2014 23:09:27 +0000 |
| Subject: | Re: difference between copy and strem_copy | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323879@lists.php.net to get a copy of this message | ||
Negin Nickparsa wrote:
> what is the difference in copying data from the file rather than a stream?
>
> stream_copy_to_stream — Copies data from one stream to another
> copy — Copies file
The most relevant difference is that copy() works with file *names*
(note, that this is not necessarily restricted to actual files, but
rather allows arbitrary streams[1]), and stream_copy_to_stream() works
with *resources* (i.e. already opened streams).
Another difference is that stream_copy_to_stream() is able to copy only
parts of a stream, whereas copy() always copies the complete file.
[1] <http://php.net/manual/en/intro.stream.php>
--
Christoph M. Becker