note 75721 modified in function.fgetcsv by danbrown

From: Date: Sun, 17 May 2009 18:10:29 +0000
Subject: note 75721 modified in function.fgetcsv by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155072@lists.php.net to get a copy of this message
A 5.2 way to lazily parse a single CSV line <?php function parseCSV($str, $delimiter = ',', $enclosure = '"', $len = 4096) { $fh = fopen('php://memory', 'rw'); fwrite($fh, $str); rewind($fh); $result = fgetcsv( $fh, $len, $delimiter, $enclosure ); fclose($fh); return $result; } ?> --was-- A 5.2 way to lazily parse a single CSV line function parseCSV($str, $delimiter = ',', $enclosure = '"', $len = 4096) { $fh = fopen('php://memory', 'rw'); fwrite($fh, $str); rewind($fh); $result = fgetcsv( $fh, $len, $delimiter, $enclosure ); fclose($fh); return $result; } http://php.net/manual/en/function.fgetcsv.php

« previous php.notes (#155072) next »