Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- perl-like "slurp" in PHP?
December 23, 2004, 4:46 am
rate this thread
'serves one purpose - to provide a simple means to read (or slurp) an
entire file into memory for processing. This module allows the
replacement of the prototypical foreach- or while- loops used for
opening and reading of files with single-line constructs.'
In its simplest use, it can read a file (everything in unix is a "file"
of strings, webpages, socket output, everything) into an array, one line
at a time into one array element.
I often use it to suck an entire webpage into an array and iterate
through the contents while in memory. I've seen routines to suck a file
into a string, so something similar will probably work for an array but
does anyone know if there's a function or class for PHP that already