18.20. Writing to Many Filehandles Simultaneously18.20.1. ProblemYou want to send output to more than one file handle; for example, you want to log messages to the screen and to a file. 18.20.2. SolutionWrap your output with a loop that iterates through your filehandles, as shown in Example 18-4. Example 18-4. pc_multi_fwrite( )
Here's an example:
18.20.3. DiscussionIf you don't want to pass a length argument to fwrite( ) (or you always want to), you can eliminate that check from your pc_multi_fwrite( ). This version doesn't accept a $length argument:
18.20.4. See AlsoDocumentation on fwrite( ) at http://www.php.net/fwrite.
Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|