3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CsvFileObject extends \SplFileObject { use CsvFileObjectTrait; public function __construct($filename, $open_mode='r', $use_include_path=false, $context=null) { parent::__construct($filename, $open_mode, $use_include_path, $context); $this->fixCsvControl(); } } class CsvTempFileObject extends \SplTempFileObject { use CsvFileObjectTrait; public function __construct ($max_memory=null) { parent::__construct($max_memory); $this->fixCsvControl(); } } trait CsvFileObjectTrait { protected function fixCsvControl() { list($delimiter, $enclosure) = $this->getCsvControl(); $this->setCsvControl($delimiter, $enclosure); } public function fgetcsv($delimiter=",", $enclosure='"', $escape='"') { return parent::fgetcsv($delimiter, $enclosure, $enclosure, $escape='"'); } public function fputcsv($fields, $delimiter=',', $enclosure='"', $escape='"') { $this->fwrite(str_putcsv_rfc($fields, $delimiter, $enclosure)); } public function setCsvControl($delimiter=",", $enclosure='"', $escape='"') { parent::setCsvControl($delimiter, $enclosure, $enclosure); } } function fputcsv_rfc($handle, $fields, $delimiter=',', $enclosure='"') { fwrite($handle, str_putcsv_rfc($fields, $delimiter, $enclosure)); } function fgetcsv_rfc($handle, $length=0, $delimiter=",", $enclosure='"') { return fgetcsv($handle, $length, $delimiter, $enclosure, $enclosure); } function str_getcsv_rfc($input, $delimiter=",", $enclosure='"') { return str_getcsv ($input, $delimiter, $enclosure, $enclosure); } function str_putcsv_rfc($fields, $delimiter=",", $enclosure='"') { $file = new SplTempFileObject(); $file->fputcsv($fields, $delimiter, $enclosure); $file->rewind(); $line = ''; while (!$file->eof()) { $line .= $file->fgets(); } return str_replace('\\'.$enclosure, '\\'.$enclosure.$enclosure, $line); } $a = new CsvTempFileObject(); $a->fwrite('"Hello \""World""!"'."\n"); $a->rewind(); $a->setFlags(CsvTempFileObject::READ_CSV); foreach ($a as $fields) { var_dump($fields); }

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.10.0040.00319.99
8.5.00.0110.01020.16
8.4.150.0010.00114.05
8.4.140.0120.00917.55
8.4.130.0090.01119.02
8.4.120.0120.00717.93
8.4.110.0140.00619.04
8.4.100.0120.00917.57
8.4.90.0110.01020.82
8.4.80.0140.00618.81
8.4.70.0060.01018.83
8.4.60.0060.01018.82
8.4.50.0070.00918.85
8.4.40.0110.00819.70
8.4.30.0070.01317.57
8.4.20.0120.00417.80
8.4.10.0100.00617.81
8.3.280.0090.01118.38
8.3.270.0090.01016.53
8.3.260.0110.00916.97
8.3.250.0090.01016.63
8.3.240.0130.00618.29
8.3.230.0070.00516.54
8.3.220.0090.01118.76
8.3.210.0110.00816.67
8.3.200.0040.00516.72
8.3.190.0090.00717.09
8.3.180.0040.00319.15
8.3.170.0120.00618.96
8.3.160.0060.00917.43
8.3.150.0040.00417.31
8.3.140.0160.00318.97
8.3.130.0030.00518.54
8.3.120.0040.00420.86
8.3.110.0030.00620.94
8.3.100.0120.00324.06
8.3.90.0040.00426.77
8.3.80.0030.00617.97
8.3.70.0120.00318.43
8.3.60.0120.00418.18
8.3.50.0130.00721.98
8.3.40.0090.00618.80
8.3.30.0090.00918.45
8.3.20.0070.00020.07
8.3.10.0060.00320.23
8.3.00.0040.00420.35
8.2.290.0150.00416.64
8.2.280.0130.00618.36
8.2.270.0160.00316.39
8.2.260.0040.00416.45
8.2.250.0150.00318.27
8.2.240.0090.00917.38
8.2.230.0090.00022.58
8.2.220.0090.00037.54
8.2.210.0060.00326.77
8.2.200.0060.00316.50
8.2.190.0140.00316.58
8.2.180.0110.00718.29
8.2.170.0110.00322.96
8.2.160.0000.01420.38
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0080.00019.36
8.2.120.0040.00426.35
8.2.110.0040.00720.52
8.2.100.0060.00617.78
8.2.90.0030.00618.03
8.2.80.0000.01018.09
8.2.70.0030.00617.50
8.2.60.0050.00317.63
8.2.50.0000.00817.55
8.2.40.0030.00519.35
8.2.30.0060.00317.66
8.2.20.0040.00717.72
8.2.10.0050.00218.09
8.2.00.0060.00317.91
8.1.330.0080.01116.35
8.1.320.0140.00517.79
8.1.310.0030.01516.65
8.1.300.0090.00016.32
8.1.290.0140.00430.84
8.1.280.0070.01025.92
8.1.270.0080.00023.80
8.1.260.0030.00528.09
8.1.250.0000.00728.09
8.1.240.0060.00323.91
8.1.230.0100.00320.99
8.1.220.0050.00517.74
8.1.210.0030.00618.77
8.1.200.0040.00417.23
8.1.190.0050.00517.10
8.1.180.0000.00818.10
8.1.170.0040.00417.62
8.1.160.0040.00418.77
8.1.150.0000.00718.86
8.1.140.0040.00417.43
8.1.130.0070.00017.68
8.1.120.0040.00417.46
8.1.110.0040.00417.36
8.1.100.0040.00417.29
8.1.90.0000.00717.33
8.1.80.0000.00717.43
8.1.70.0000.00717.42
8.1.60.0000.00817.55
8.1.50.0080.00017.38
8.1.40.0030.00517.51
8.1.30.0080.00017.61
8.1.20.0040.00417.58
8.1.10.0040.00417.43
8.1.00.0050.00217.42
8.0.300.0040.00420.16
8.0.290.0040.00416.88
8.0.280.0090.00018.05
8.0.270.0030.00617.96
8.0.260.0070.00017.30
8.0.250.0030.00316.98
8.0.240.0030.00317.07
8.0.230.0000.00716.90
8.0.220.0000.00716.87
8.0.210.0040.00416.94
8.0.200.0000.00616.97
8.0.190.0000.00717.01
8.0.180.0000.00716.84
8.0.170.0060.00316.86
8.0.160.0040.00316.93
8.0.150.0040.00416.95
8.0.140.0040.00416.77
8.0.130.0000.00613.39
8.0.120.0060.00316.93
8.0.110.0050.00316.91
8.0.100.0000.00716.78
8.0.90.0000.00716.74
8.0.80.0070.00716.98
8.0.70.0040.00416.96
8.0.60.0040.00416.92
8.0.50.0040.00416.99
8.0.30.0100.01117.16
8.0.20.0120.00817.40
8.0.10.0020.00516.88
8.0.00.0110.00716.81
7.4.330.0020.00216.95
7.4.320.0060.00016.58
7.4.300.0000.00616.65
7.4.290.0050.00216.64
7.4.280.0110.00016.64
7.4.270.0000.00716.68
7.4.260.0040.00416.63
7.4.250.0000.00816.60
7.4.240.0000.00716.66
7.4.230.0000.00816.39
7.4.220.0030.01416.61
7.4.210.0100.01016.73
7.4.200.0040.00416.46
7.4.160.0030.01416.55
7.4.150.0180.00017.40
7.4.140.0130.00817.86
7.4.130.0050.01216.48
7.4.120.0110.00716.54
7.4.110.0090.00916.74
7.4.100.0110.01116.43
7.4.90.0110.00616.42
7.4.80.0160.00619.39
7.4.70.0050.01116.57
7.4.60.0130.00316.61
7.4.50.0000.01316.63
7.4.40.0080.00816.70
7.4.30.0120.00616.46
7.4.00.0100.00715.04
7.3.330.0030.00313.35
7.3.320.0070.00013.43
7.3.310.0050.00316.53
7.3.300.0040.00216.48
7.3.290.0080.00816.39
7.3.280.0100.00916.40
7.3.270.0090.00917.40
7.3.260.0130.00616.65
7.3.250.0140.00716.54
7.3.240.0040.01316.59
7.3.230.0120.00816.65
7.3.210.0100.00716.69
7.3.200.0060.01519.39
7.3.190.0090.01216.52
7.3.180.0120.00316.56
7.3.170.0100.00716.34
7.3.160.0060.01016.73
7.2.330.0170.00316.77
7.2.320.0160.00916.56
7.2.310.0150.00916.81
7.2.300.0180.00616.76
7.2.290.0040.01316.51
7.2.110.0160.01116.47
7.2.100.0100.01716.75
7.2.90.0230.01816.77
7.2.80.0210.01016.41
7.2.70.0250.00516.88
7.2.60.0160.00716.83
7.2.50.0180.00816.90
7.2.40.0190.00617.09
7.2.30.0310.01417.15
7.2.20.0160.01117.12
7.2.10.0350.01217.00
7.2.00.0260.00017.05
7.1.230.0380.00715.76
7.1.220.0310.00715.70
7.1.210.0110.01115.65
7.1.200.0160.00115.77
7.1.190.0150.01115.64
7.1.180.0130.00915.44
7.1.170.0350.00315.47
7.1.160.0180.00915.69
7.1.150.0130.00815.95
7.1.140.0120.01215.92
7.1.130.0110.00815.61
7.1.120.0070.01415.86
7.1.110.0150.00815.84
7.1.100.0160.00815.93
7.1.90.0160.00615.71
7.1.80.0650.01015.73
7.1.70.0060.00916.40
7.1.60.0190.00917.57
7.1.50.0110.02115.80
7.1.40.0160.01415.82
7.1.30.0660.00015.64
7.1.20.0570.01115.86
7.1.10.0120.00715.74
7.1.00.0280.04019.10
7.0.310.0360.00615.54
7.0.300.0130.00715.20
7.0.290.0270.01015.30
7.0.280.0150.00915.28
7.0.270.0350.00415.38
7.0.260.0310.00215.32
7.0.250.0310.01115.46
7.0.240.0100.01015.51
7.0.230.0330.00715.64
7.0.220.0120.00615.40
7.0.210.0280.00615.04
7.0.200.0070.00915.88
7.0.190.0500.00815.36
7.0.180.0120.00615.59
7.0.170.0170.00715.52
7.0.160.0080.01615.60
7.0.150.0330.00415.43
7.0.140.0100.01115.64
7.0.130.0210.01215.27
7.0.120.0410.00815.23
7.0.110.0270.00515.09
7.0.100.0380.00915.11
7.0.90.0370.00715.23
7.0.80.0300.00415.41
7.0.70.0200.00715.36
7.0.60.0320.02617.65
7.0.50.0120.02616.61
7.0.40.0120.03716.80
7.0.30.0150.04816.77
7.0.20.0240.04516.78
7.0.10.0100.02716.66
7.0.00.0120.03316.80
5.6.380.0190.00614.53
5.6.370.0160.00614.25
5.6.360.0130.00714.83
5.6.350.0170.00314.30
5.6.340.0200.01114.75
5.6.330.0180.01014.24
5.6.320.0180.00714.34
5.6.310.0160.00714.68
5.6.300.0040.01614.60
5.6.290.0220.00014.82
5.6.280.0120.04017.72
5.6.270.0250.00614.52
5.6.260.0260.01514.30
5.6.250.0160.01414.07
5.6.240.0370.00414.57
5.6.230.0270.01214.42
5.6.220.0280.00614.27
5.6.210.0200.03517.45
5.6.200.0110.03516.29
5.6.190.0160.04017.51
5.6.180.0070.02617.51
5.6.170.0230.03017.33
5.6.160.0120.03717.43
5.6.150.0140.01816.23
5.6.140.0130.02116.22
5.6.130.0110.02616.18
5.6.120.0120.03317.61
5.6.110.0160.04317.59
5.6.100.0160.04317.87
5.6.90.0150.01917.67
5.6.80.0090.04417.49
5.6.70.0140.00914.16
5.6.60.0160.00914.38
5.6.50.0160.00714.46
5.6.40.0160.00914.26
5.6.30.0150.00714.48
5.6.20.0150.00913.95
5.6.10.0160.00814.30
5.6.00.0150.00914.51
5.5.380.0160.00711.34
5.5.370.0130.00711.15
5.5.360.0180.00411.21
5.5.350.1690.01615.91
5.5.340.0110.04214.71
5.5.330.0120.04515.66
5.5.320.0200.04015.79
5.5.310.0170.04415.88
5.5.300.0130.03814.56
5.5.290.0100.04214.58
5.5.280.0110.02816.06
5.5.270.0100.03516.09
5.5.260.0110.04516.05
5.5.250.0150.04015.84
5.5.240.0150.03715.67
5.5.230.0050.01011.26
5.5.220.0110.00310.98
5.5.210.0130.00011.20
5.5.200.0070.00711.01
5.5.190.0100.00711.27
5.5.180.0080.00811.19
5.5.170.0140.00914.35
5.5.160.0140.00411.19
5.5.150.0100.00611.21
5.5.140.0180.00011.05
5.5.130.0090.00511.23
5.5.120.0110.00411.14
5.5.110.0110.00411.11
5.5.100.0080.00811.04
5.5.90.0110.00510.85
5.5.80.0080.00811.34
5.5.70.0100.00310.94
5.5.60.0090.00710.94
5.5.50.0000.01311.25
5.5.40.0060.00511.28
5.5.30.0130.00311.21
5.5.20.0100.00511.03
5.5.10.0130.00411.02
5.5.00.0050.01111.00

preferences:
175.45 ms | 403 KiB | 5 Q