3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Definir cabeçalhos para a codificação correta header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename=exported_data.csv'); $fileName = $orderId . ".csv"; $file = fopen($fileName, "w+"); // Added + for read/write mode. // Escreve o BOM (Byte Order Mark) para indicar UTF-8 fputs($file, chr(0xEF) . chr(0xBB) . chr(0xBF)); // Write the header row $headerRow = ["ID", "Item", "Price", "Amount", "Total", "Description"]; fputcsv($file, $headerRow); // Loop over each item in the $items array foreach ($items as $item) { // Build an array containing information about the item $itemArray = [ $item->ID, $item->Name, $item->Price . $currency, $item->Amount, $item->Price * $item->Amount . $currency, $item->Description ]; // Write the item information to the file fputcsv($file, $itemArray); } // Write the total row $totalRow = ["Grand total", "", "", $totalAmount, $total . $currency, ""]; fputcsv($file, $totalRow); // Close the file fclose($file); $fileUrl = "https://" . $_SERVER['HTTP_HOST'] . "/" . $fileName;

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.3.120.0030.00718.80
8.3.110.0000.00920.94
8.3.100.0130.00716.61
8.3.90.0050.00318.23
8.3.80.0200.01430.84
8.3.70.0270.00730.84
8.3.60.0090.00630.84
8.3.50.0070.00330.84
8.3.40.0200.00430.84
8.3.30.0240.00730.84
8.3.20.0230.00030.84
8.3.10.0150.00730.84
8.3.00.0160.00730.84
8.2.240.0090.00017.29
8.2.230.0000.00822.58
8.2.220.0080.00024.06
8.2.210.0030.00726.77
8.2.200.0190.00330.84
8.2.190.0170.00730.84
8.2.180.0200.00330.84
8.2.170.0260.00330.84
8.2.160.0190.00930.84
8.2.150.0190.00930.84
8.2.140.0210.00430.84
8.2.130.0240.00330.84
8.2.120.0230.00530.84
8.2.110.0270.00930.84
8.2.100.0260.00330.84
8.2.90.0200.00330.84
8.2.80.0240.00030.84
8.2.70.0160.01030.84
8.2.60.0110.00030.84
8.2.50.0190.00330.84
8.2.40.0180.00430.84
8.2.30.0190.00430.84
8.2.20.0230.00330.84
8.2.10.0170.00930.84
8.2.00.0210.00330.84
8.1.300.0120.00318.48
8.1.290.0200.00330.84
8.1.280.0190.00730.84
8.1.270.0190.00530.84
8.1.260.0240.00030.84
8.1.250.0230.00430.84
8.1.240.0160.00630.84
8.1.230.0240.00430.84
8.1.220.0260.00930.84
8.1.210.0160.00830.84
8.1.200.0180.00730.84
8.1.190.0220.00330.84
8.1.180.0180.00430.84
8.1.170.0200.00730.84
8.1.160.0200.00430.84
8.1.150.0140.00730.84
8.1.140.0170.00330.84
8.1.130.0100.01030.84
8.1.120.0270.00030.84
8.1.110.0260.01130.84
8.1.100.0270.01330.84
8.1.90.0260.00930.84
8.1.80.0120.02030.84
8.1.70.0310.00330.84
8.1.60.0220.02230.84
8.1.50.0400.00430.84
8.1.40.0260.01330.84
8.1.30.0250.00930.84
8.1.20.0330.00930.84
8.1.10.0310.01430.84
8.1.00.0290.00630.84

preferences:
30.15 ms | 403 KiB | 5 Q