<?php
/* Open a test file for reading and writing */
$fp = fopen("test.txt", "rw");
$rot13_filter = stream_filter_append($fp, "string.rot13", STREAM_FILTER_WRITE);
fwrite($fp, "This is ");
stream_filter_remove($rot13_filter);
fwrite($fp, "a test\n");
rewind($fp);
fpassthru($fp);
fclose($fp);
?>
The above example will output: