English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP String Character String Function Manual
The str_getcsv() function is used to parse CSV strings into arrays.
array str_getcsv ( string $input [, string $delimiter = "," [, string $enclosure = '"' [, string $escape = '\\' ]]] )
It is used to parse CSV format field strings and return an array containing the fields read.
It returns an indexed array.
Serial Number | Parameters and Description |
---|---|
1 | input The string to be parsed |
2 | delimiter Set the field delimiter character (only one character is allowed), the default value is a comma (,) |
3 | enclosure Set the field delimiter character (only one character is allowed), the default value is the double quote (") |
4 | escape Set the escape character (only one character is allowed), the default value is the backslash (\) |
Try the following example to parse CSV format field files and return an array containing the fields read.
<?php //Parse CSV format field files and return an array containing the fields read. $csv = array_map('str_getcsv', file('Str.csv')); ?>