CSV (Comma-Separated Values) is one of the most common data exchange formats. PHP has built-in functions specifically for reading and writing CSV that handle quoting, escaping, and delimiters correctly.
fgetcsv() reads one row at a time from an open file handle.
fputcsv() writes an array as a properly escaped CSV row.
str_getcsv() parses a CSV string (useful for single lines from APIs).
Tip: When exporting CSV for Microsoft Excel, prepend the UTF-8 BOM (\"\xEF\xBB\xBF\") before the first row. Without it, Excel often misinterprets non-ASCII characters in the default encoding.