Revision: 4173
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 30, 2007 18:58 by micmath
Initial Code
$value = "Ennie,Meenie,Minie,Mo";
$fh = fopen('php://memory', 'rw');
fwrite($fh, $value);
rewind($fh);
$array = fgetcsv($fh, 1024);
fclose($fh);
Initial URL
Initial Description
Occasionally you'll have a string and need to pass it to a function that will only take a filehandle (such as fgetcsv). Here's how to create a virtual filehandle in memory.
Initial Title
Treat variable as a file
Initial Tags
Initial Language
PHP