helly Sat Jul 15 15:04:52 2006 UTC Modified files: /php-src/ext/spl/internal splfileobject.inc Log: - Update docu http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/splfileobject.inc?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/spl/internal/splfileobject.inc diff -u php-src/ext/spl/internal/splfileobject.inc:1.3 php-src/ext/spl/internal/splfileobject.inc:1.4 --- php-src/ext/spl/internal/splfileobject.inc:1.3 Tue Feb 21 23:21:53 2006 +++ php-src/ext/spl/internal/splfileobject.inc Sat Jul 15 15:04:52 2006 @@ -12,7 +12,7 @@ /** @ingroup SPL * @brief Object representation for any stream * @author Marcus Boerger - * @version 1.0 + * @version 1.1 * @since PHP 5.1 */ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIterator @@ -26,6 +26,8 @@ private $lnum = 0; private $max_len = 0; private $flags = 0; + private $delimiter= ','; + private $enclosure= '"'; /** * Constructs a new file object @@ -80,14 +82,44 @@ * @param enclosure end of * @return array containing read data */ - function fgetcsv($delimiter = ';', $enclosure = '') + function fgetcsv($delimiter = NULL, $enclosure = NULL) { $this->freeLine(); $this->lnum++; + switch(fun_num_args()) + { + case 0: + $delimiter = $this->delimiter; + case 1: + $enclosure = $this->enclosure; + default: + case 2: + break; + } return fgetcsv($this->fp, $this->max_len, $delimiter, $enclosure); } /** + * Set the delimiter and enclosure character used in fgetcsv + * + * @param delimiter new delimiter, defaults to ',' + * @param enclosure new enclosure, defaults to '"' + */ + function setCsvControl($delimiter = ';', $enclosure = '"') + { + $this->delimiter = $delimiter; + $this->enclosure = $enclosure; + } + + /** + * @return array(delimiter, enclosure) as used in fgetcsv + */ + function getCsvControl($delimiter = ',', $enclosure = '"') + { + return array($this->delimiter, $this->enclosure); + } + + /** * @param operation lock operation (LOCK_SH, LOCK_EX, LOCK_UN, LOCK_NB) * @retval $wouldblock whether the operation would block */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php