stream_copy_to_stream
Copies data from one stream to another
Description
intfalse stream_copy_to_stream(
resource $from
,
resource $to
,
intnull $length
= null
,
int $offset
= 0
)
Parameters
-
from
-
The source stream
-
to
-
The destination stream
-
length
-
Maximum bytes to copy. By default all bytes left are copied.
-
offset
-
The offset where to start to copy data
Return Values
Returns the total count of bytes copied, or false
on failure.
Examples
Example #1 A stream_copy_to_stream example
<?php
$src = fopen('http://www.example.com', 'r');
$dest1 = fopen('first1k.txt', 'w');
$dest2 = fopen('remainder.txt', 'w');
echo stream_copy_to_stream($src, $dest1, 1024) . " bytes copied to first1k.txt\n";
echo stream_copy_to_stream($src, $dest2) . " bytes copied to remainder.txt\n";
?>