The first thing that comes to my mind is output buffering. echo and print with output buffering mechanism, but writing directly to stdout bypasses it.
Consider this script:
<?php $stdout = fopen('php://stdout', 'w'); ob_start(); echo "echo output\n"; fwrite($stdout, "FWRITTEN\n"); echo "Also echo\n"; $out = ob_get_clean(); echo $out;
which outputs:
FWRITTEN echo output Also echo
which demonstrates that echo buffered, while fwrite is not.
source share