'How to fwrite to web out in PHP

Say I have this cose:

function saysomething($msg) {
    $fd = fopen(STDOUT, 'a');
    fwrite($fd, $msg);
    fclsoe($fd);
}
saysomething('test message');

That will work from the command line, but not when called as a web page. What do I need to replace the STDOUT with, to be able to write to web output?

echo outputs equally well when run either way, so I would expect it to be possible, since I can use fwrite to print to stdout. Is there a magic constant or file descriptor number or something that will let me use fwrite on a web page?

php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source