Query: stream_copy_to_stream
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
STREAM_COPY_TO_STREAM(3) 1 STREAM_COPY_TO_STREAM(3) stream_copy_to_stream - Copies data from one stream to anotherSYNOPSISint stream_copy_to_stream (resource $source, resource $dest, [int $maxlength = -1], [int $offset])DESCRIPTIONMakes a copy of up to $maxlength bytes of data from the current position (or from the $offset position, if specified) in $source to $dest. If $maxlength is not specified, all remaining content in $source will be copied.PARAMETERSo $source - The source stream o $dest - The destination stream o $maxlength - Maximum bytes to copy o $offset - The offset where to start to copy dataRETURN VALUESReturns the total count of bytes copied.CHANGELOG+--------+------------------------------+ |Version | | | | | | | Description | | | | +--------+------------------------------+ | 5.1.0 | | | | | | | Added the $offset parameter | | | | +--------+------------------------------+EXAMPLESExample #1 A stream_copy_to_stream(3) 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 "; echo stream_copy_to_stream($src, $dest2) . " bytes copied to remainder.txt "; ?>SEE ALSOcopy(3). PHP Documentation Group STREAM_COPY_TO_STREAM(3)