Home > PHP > Function > Strings > str_getcsv()

str_getcsv()

str_getcsv - Parse a CSV string into an array

Syntax

array str_getcsv (string $input, string $delimiter, string $enclosure, string $escape)

Arguments

  • input - The string to parse.
  • delimiter - Set the field delimiter (one character only).
  • enclosure - Set the field enclosure character (one character only).
  • escape - Set the escape character (one character only). Defaults as a backslash ( \)

Description

Similar to fgetcsv() this functions parses a string as its input unlike fgetcsv() which takes a file as its input.

Version

PHP 5.3.0

Return value

Returns an indexed array containing the fields read.