3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ "test1", "test2", "test3", "test4", "test5", ]; $handle = fopen('php://memory', 'w+'); // Accepting the default values doesnt work fputcsv($handle, $data); // Providing all default parameter values work fputcsv($handle, $data, ",", "\"", "\\", "\n"); fclose($handle);
Output for 8.4.1 - 8.4.13
Deprecated: fputcsv(): the $escape parameter must be provided as its default value will change in /in/aRvTD on line 14
Output for 8.1.0 - 8.1.32, 8.2.25 - 8.2.29, 8.3.5 - 8.3.26
Output for 8.0.0 - 8.0.30
Fatal error: Uncaught ArgumentCountError: fputcsv() expects at most 5 arguments, 6 given in /in/aRvTD:17 Stack trace: #0 /in/aRvTD(17): fputcsv(Resource id #5, Array, ',', '"', '\\', '\n') #1 {main} thrown in /in/aRvTD on line 17
Process exited with code 255.
Output for 5.6.40, 7.0.8, 7.2.0, 7.4.33
Warning: fputcsv() expects at most 5 parameters, 6 given in /in/aRvTD on line 17
Output for 4.3.11, 5.0.5
Parse error: parse error, unexpected '[' in /in/aRvTD on line 3
Process exited with code 255.

preferences:
90.28 ms | 411 KiB | 5 Q