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

preferences:
51.11 ms | 529 KiB | 5 Q