Skip to content

Instantly share code, notes, and snippets.

@rsky
Created July 24, 2011 12:26
Show Gist options
  • Save rsky/1102568 to your computer and use it in GitHub Desktop.
Save rsky/1102568 to your computer and use it in GitHub Desktop.
STDOUTにstream_filter_append
<?php
$stream1 = fopen('php://output', 'wb');
stream_filter_append($stream1, 'string.rot13');
fwrite($stream1, "hoge\n");
fwrite(STDOUT, "hoge\n");
echo "hoge\n";
echo "-\n";
$stream2 = fopen('php://stdout', 'wb');
stream_filter_append($stream2, 'string.rot13');
fwrite($stream2, "hoge\n");
fwrite(STDOUT, "hoge\n");
echo "hoge\n";
echo "-\n";
stream_filter_append(STDOUT, 'string.rot13');
fwrite(STDOUT, "hoge\n");
echo "hoge\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment