You want to write to standard output.
Use echo or print( ) print, as in Example 23-36.
Writing to standard output
While print( ) is a function, echo is a language construct. This means that print( ) returns a value, while echo doesn't. You can include print( ) but not echo in larger expressions, as shown in Example 23-37.
echo versus print
Use php://stdout as the filename if you're using the file functions $fh = fopen('php://stdout','w') or die($php_errormsg);.
Writing to standard output via a filehandle instead of simply with print( ) or echo is useful if you need to abstract where your output goes, or if you need to print to standard output at the same time as writing to a file. See Recipe 23.15 for details.
You can also write to standard error by opening php://stderr: $fh = fopen('php://stderr','w');.
23.14.4. See Also
Recipe 23.15 for writing to many filehandles simultaneously; documentation on echo at http://www.php.net/echo and on print( ) at http://www.php.net/print.