3v4l.org

run code in 500+ PHP versions simultaneously
<?php // build something entirely in memory... $fp = fopen('php://memory', 'r+'); fputcsv($fp, ['name', 'email', 'role']); fputcsv($fp, ['Alex', 'alex@example.com', 'CTO']); fputcsv($fp, ['Jane', 'jane@example.com', 'Dev']); rewind($fp); $csv = stream_get_contents($fp); fclose($fp); // send as download header('Content-Type: text/csv'); echo $csv; // php://temp, same but spills to disk over 2MB... or more! $fp = fopen('php://temp/maxmemory:8388608', 'r+'); // 8MB in RAM, then auto-swaps to a temp file // no gc, no unlink(), no /tmp pollution // the stream disappears when $fp is closed
Output for 8.4.9 - 8.4.21, 8.5.3 - 8.5.6
Deprecated: fputcsv(): the $escape parameter must be provided as its default value will change in /in/UFBcn on line 5 Deprecated: fputcsv(): the $escape parameter must be provided as its default value will change in /in/UFBcn on line 6 Deprecated: fputcsv(): the $escape parameter must be provided as its default value will change in /in/UFBcn on line 7 Warning: Cannot modify header information - headers already sent by (output started at /in/UFBcn:5) in /in/UFBcn on line 14 name,email,role Alex,alex@example.com,CTO Jane,jane@example.com,Dev
Output for 8.3.5 - 8.3.18
name,email,role Alex,alex@example.com,CTO Jane,jane@example.com,Dev

preferences:
56.78 ms | 522 KiB | 4 Q