note 88311 modified in function.str-getcsv by danbrown

From: Date: Tue, 20 Jan 2009 00:50:57 +0000
Subject: note 88311 modified in function.str-getcsv by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-149497@lists.php.net to get a copy of this message
Don't have this? Ask fgetcsv() to do it for you. 5.1.0+ <?php if (!function_exists('str_getcsv')) { function str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") { $fiveMBs = 5 * 1024 * 1024; $fp = fopen("php://temp/maxmemory:$fiveMBs", 'r+'); fputs($fp, $input); rewind($fp); $data = fgetcsv($fp, 1000, $delimiter, $enclosure); // $escape only got added in 5.3.0 fclose($fp); return $data; } } ?> --was-- Don't have this? Ask fgetcsv() to do it for you. 5.1.0+ if (!function_exists('str_getcsv')) { function str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") { $fiveMBs = 5 * 1024 * 1024; $fp = fopen("php://temp/maxmemory:$fiveMBs", 'r+'); fputs($fp, $input); rewind($fp); $data = fgetcsv($fp, 1000, $delimiter, $enclosure); // $escape only got added in 5.3.0 fclose($fp); return $data; } } http://php.net/manual/en/function.str-getcsv.php

« previous php.notes (#149497) next »