str_getcsv
Function • Params and return types changed in PHP 8.0
Parse a CSV string into an array.
str_getcsv
Function synopsis
str_getcsv(
string $string,
string $separator = ",",
string $enclosure = "\"",
string $escape = "\\"
): array
Parameters
$string
Typestring
The string to parse.
$separator
OptionalTypestring
Default value","
$enclosure
OptionalTypestring
Default value"\""
$escape
OptionalTypestring
Default value"\"
Return value
Typearray
Returns an indexed array containing the fields read.
Changes to the str_getcsv
Function
PHP 8.4
PHP 8.0
- Return type added:
array
- Parameter type added for parameter #1 (
$string
):string
- Parameter name of parameter #2 changed:
$delimiter
to$separator
- Parameter type added for parameter #2 (
$separator
):string
- Parameter default value added for position #2 (
$separator
):","
- Parameter type added for parameter #3 (
$enclosure
):string
- Parameter default value added for position #3 (
$enclosure
):"\""
- Parameter type added for parameter #4 (
$escape
):string
- Parameter default value added for position #4 (
$escape
):"\\"
str_getcsv(
- $string,
+ string $string,
- $delimiter,
+ string $separator = ",",
- $enclosure,
+ string $enclosure = "\"",
- $escape
+ string $escape = "\\"
- )
+ ): array
str_getcsv
Function Availability
str_getcsv
Function AvailabilityPHP Version | Availability |
---|---|
PHP 8.5Future Release | Yes |
PHP 8.4Upcoming Release | Yes |
PHP 8.3Supported (Latest) | Yes |
PHP 8.2Supported | Yes |
PHP 8.1Security-Fixes Only | Yes |
PHP 8.0Unsupported | Yes |
PHP 7.4Unsupported | Yes |
PHP 7.3Unsupported | Yes |
PHP 7.2Unsupported | Yes |
PHP 7.1Unsupported | Yes |
PHP 7.0Unsupported | Yes |
PHP 5.6Unsupported | Yes |
PHP 5.5Unsupported | Yes |
PHP 5.4Unsupported | Yes |
PHP 5.3Unsupported | Yes |