3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * The value of the $escape parameter doesn't matter * unless it's set to the one character that makes sense * then it f's up the escaping and produces invalid CSV data * */ $fh = fopen('php://stdout', 'w'); fputcsv($fh, ['using default', 'a,"b'], ',', '"'); fputcsv($fh, ['using " ', 'a,"b'], ',', '"', '"'); fputcsv($fh, ['using x ', 'a,"b'], ',', '"', 'x'); fputcsv($fh, ['using \\ ', 'a,"b'], ',', '"', '\\');

preferences:
46.31 ms | 402 KiB | 5 Q