public static function appendTo($src, $dest, $newline = false) {

        // Open the destination.
        $reader = @fopen($src, "r");
        if (false === $reader) {
            throw new FileNotFoundException($src);
        }

        // Open the destination.
        $writer = @fopen($dest, "a");
        if (false === $writer) {
            throw new IOException(sprintf("Failed to open \"%s\"", $dest));
        }

        // Append the source into destination.
        if (false === @file_put_contents($dest, $reader, FILE_APPEND)) {
            throw new IOException(sprintf("Failed to append \"%s\" into \"%s\"", $src, $dest));
        }

        // Append a new line.
        if (true === $newline && false === @file_put_contents($dest, "\n", FILE_APPEND)) {
            throw new IOException(sprintf("Failed to append \"%s\" into \"%s\"", $src, $dest));
        }

        // Close the files.
        if (false === @fclose($reader)) {
            throw new IOException(sprintf("Failed to close \"%s\"", $src));
        }
        if (false === @fclose($writer)) {
            throw new IOException(sprintf("Failed to close \"%s\"", $dest));
        }
    }
public static function appendTo($src, $dest, $newline = false) {

        // Open the destination.
        $reader = @fopen($src, "r");
        if (false === $reader) {
            throw new FileNotFoundException($src);
        }

        // Open the destination.
        $writer = @fopen($dest, "a");
        if (false === $writer) {
            throw new IOException(sprintf("Failed to open \"%s\"", $dest));
        }

        // Append the source into destination.
        if (false === @file_put_contents($dest, $reader, FILE_APPEND)) {
            throw new IOException(sprintf("Failed to append \"%s\" into \"%s\"", $src, $dest));
        }

        // Append a new line.
        if (true === $newline && false === @file_put_contents($dest, "\n", FILE_APPEND)) {
            throw new IOException(sprintf("Failed to append \"%s\" into \"%s\"", $src, $dest));
        }

        // Close the files.
        if (false === @fclose($reader)) {
            throw new IOException(sprintf("Failed to close \"%s\"", $src));
        }
        if (false === @fclose($writer)) {
            throw new IOException(sprintf("Failed to close \"%s\"", $dest));
        }
    }
public static function appendTo ( $ src , $ dest , $ newline = false ) { // Open the destination. $ reader = @ fopen ( $ src , "r" ) ; if ( false === $ reader ) { throw new FileNotFoundException ( $ src ) ; } // Open the destination. $ writer = @ fopen ( $ dest , "a" ) ; if ( false === $ writer ) { throw new IOException ( sprintf ( "Failed to open \"%s\"" , $ dest ) ) ; } // Append the source into destination. if ( false === @ file_put_contents ( $ dest , $ reader , FILE_APPEND ) ) { throw new IOException ( sprintf ( "Failed to append \"%s\" into \"%s\"" , $ src , $ dest ) ) ; } // Append a new line. if ( true === $ newline && false === @ file_put_contents ( $ dest , "\n" , FILE_APPEND ) ) { throw new IOException ( sprintf ( "Failed to append \"%s\" into \"%s\"" , $ src , $ dest ) ) ; } // Close the files. if ( false === @ fclose ( $ reader ) ) { throw new IOException ( sprintf ( "Failed to close \"%s\"" , $ src ) ) ; } if ( false === @ fclose ( $ writer ) ) { throw new IOException ( sprintf ( "Failed to close \"%s\"" , $ dest ) ) ; } }
Append to.

@param string $src The source filename.
@param string $dest The destination filename.
@param bool $newline New line ?
@return void
@throws IOException Throws an I/O exception if an error occurs.
Append to .