Function CMS_CSV_Reader->getcsv_record
Definitions
sources/files_spreadsheets_read.php
- Get a CSV record, equivalent to PHP's fgetcsv. However, we don't use fgetcsv because:1) We need to do character set conversions efficiently for whole file lines2) fgetcsv (and str_getcsv) depends on locales, which are not thread-safe in PHP so cannot be reliably set correctly
- Visibility: protected
- Is abstract?: No
- Is static?: No
- Is final?: No
Parameters
Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
---|---|---|---|---|---|---|---|
$handle | resource | No | No | required parameter | N/A | N/A | The file |
$charset | string | No | No | required parameter | N/A | N/A | The character set |
$delimiter | string | No | No | required parameter | N/A | N/A | The delimiter |
Returns
- Row (false: error)
- Type: ~array
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Get a CSV record, equivalent to PHP's fgetcsv. However, we don't use fgetcsv because:1) We need to do character set conversions efficiently for whole file lines2) fgetcsv (and str_getcsv) depends on locales, which are not thread-safe in PHP so cannot be reliably set correctly
*
* @param resource $handle The file
* @param string $charset The character set
* @param string $delimiter The delimiter
* @return ~array Row (false: error)
*/
protected function getcsv_record($handle, string $charset, string $delimiter)
* Get a CSV record, equivalent to PHP's fgetcsv. However, we don't use fgetcsv because:1) We need to do character set conversions efficiently for whole file lines2) fgetcsv (and str_getcsv) depends on locales, which are not thread-safe in PHP so cannot be reliably set correctly
*
* @param resource $handle The file
* @param string $charset The character set
* @param string $delimiter The delimiter
* @return ~array Row (false: error)
*/
protected function getcsv_record($handle, string $charset, string $delimiter)