fwrite

(FW >= 1.0)

fwrite - Write data to a file, socket or stream

Description

int fwrite( int $handle, mixed $data )

This will write the data passed in $data to the resource previous opened

Parameters

handle

handle of open file

data

The data to be written. This can be a string, number or array of data.  If a number is passed it will write 8 bits.
If an array is passed as a parameter, the data can contain both numbers (int) and strings.  This can be useful when writing binary data to a stream such as a socket.

Return Value

1=success, 0=failure

Examples

<? 
$fp = fopen("/test.txt","w");
if (!$fp) {
    print("File open failed\n");
} else {
$res = fwrite($fp,"Testing this write");
if ($res) {
print("An error occured while trying to write to the file");
} fclose($fp); } ?>