3v4l.org

run code in 500+ PHP versions simultaneously
<?php // Speedy yet memory intensive version $f = fopen('php://memory', 'w+'); foreach($data_source as $row) { // You may configure fputcsv as usual fputcsv($f, $row); } rewind($f); // Important $fp = fopen('final.csv', 'w+'); fputs($fp, stream_get_contents($f)); fclose($fp); fclose($f); // Slower version $fp = fopen('final.csv', 'w+'); foreach($data_source as $row) { // You may configure fputcsv as usual fputcsv($fp, $row); } fclose($fp); ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.90.0060.01218.75
8.5.80.0090.00816.93
8.5.70.0090.00816.83
8.5.60.0130.00516.91
8.5.50.0040.00516.80
8.5.30.0100.00816.84
8.4.240.0130.01019.73
8.4.230.0130.00519.84
8.4.220.0130.00919.53
8.4.210.0070.01521.61
8.4.180.0110.00821.69
8.4.90.0070.01119.89
8.3.330.0140.00718.60
8.3.320.0120.00718.83
8.3.310.0120.00918.68
8.3.180.0070.00316.87
8.3.50.0100.01016.79
8.2.320.0130.00618.24
8.2.310.0080.01218.29

preferences:
42.64 ms | 564 KiB | 5 Q