The difference betweem adding a stream filter first or last in the filte list in only the order they will be applied to streams.
For example, if you're reading data from a file, and a given filter is placed in first place with stream_filter_prepend()the data will be processed by that filter first.
This example reads out file data and the filter is applied at the beginning of the reading operation:
$fp = fopen("test.txt", "r");
On the other hand, if stream_filter_append() is used, then the filter will be applied at the end of the data operation. The thing about this is only the order filters are applied to streams. Back to the example, it's not the same thing removing new lines from file data and then counting the number of characters, than performing the inverse process. In this case, the order that filters are applied to stream is important.
This example writes a test string to a file. The filter is applied at the end of the writing operation:
$fp = fopen("test.txt", "w+");
fwrite($fp, "This is a test\n"); first written, then ROT13 tranformed and lastly
written to file
In the first case, data is transformed at the end of the writing operation, while in the second one, data is first filtered and then stored in $contents.