3v4l.org

run code in 300+ PHP versions simultaneously
<?php require_once dirname(__FILE__) . '/pclzip/pclzip.lib.php'; /** * This is an enhanced version of PclZip class with the following additions: * - support for adding empty folders * - support for adding files with completely changed local name, not only path * - compression algorithm info is added to file info */ class ziparchive_PclZip extends PclZip { /** * @param string $name * @return array|int */ function addEmptyFolder($name) { return $this->privAdd(array( array( 'filename' => (string) $name, 'type' => 'virtual_folder', ), ), $p_result_list, $p_options); } /** * @param string $p_filename * @param array &$p_header * @return int */ function privAddVirtualFolder($p_filename, &$p_header) { $p_filename = trim($p_filename, '/\\') . '/'; $p_header['version'] = 20; $p_header['version_extracted'] = 10; $p_header['flag'] = 0; $p_header['compression'] = 0; $p_header['crc'] = 0; $p_header['size'] = 0; $p_header['compressed_size'] = 0; $p_header['disk'] = 0; $p_header['offset'] = 0; $p_header['internal'] = 0; $p_header['external'] = 0x00000010; $p_header['status'] = 'ok'; $p_header['index'] = -1; $p_header['mtime'] = time(); $p_header['filename'] = $p_filename; $p_header['filename_len'] = strlen($p_filename); $p_header['stored_filename'] = $p_filename; $p_header['comment'] = ''; $p_header['comment_len'] = 0; $p_header['extra'] = ''; $p_header['extra_len'] = 0; return $this->privWriteFileHeader($p_header); } /** * @param array $p_filedescr_list * @param array $p_result_list * @param array $p_options * @return array */ function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options) { // add virtual folders first, as they are not supported by the // parent implementation $v_result = 1; $v_nb = count($p_result_list); for ($i = 0; ($i < count($p_filedescr_list)) && ($v_result == 1); ++$i) { $p_filedescr = &$p_filedescr_list[$i]; // ensure file names have no trailing slashes - as might be the // case when the original file name is completely removed by // PCLZIP_OPT_ADD_PATH and PCLZIP_OPT_REMOVE_PATH options in add() if (strpos($p_filedescr['type'], 'file') !== false && substr($p_filedescr['stored_filename'], -1) === '/' ) { $p_filedescr['stored_filename'] = substr($p_filedescr['stored_filename'], 0, -1); } if ($p_filedescr['type'] === 'virtual_folder') { $v_result = $this->privAddVirtualFolder($p_filedescr['filename'], $v_header); if ($v_result != 1) { return $v_result; } $p_result_list[$v_nb++] = $v_header; unset($p_filedescr_list[$i]); } } $p_filedescr_list = array_values($p_filedescr_list); $v_result = parent::privAddFileList($p_filedescr_list, $p_result_list, $p_options); return $v_result; } /** * @param array $p_header * @param array &$p_info * @return int */ function privConvertHeader2FileInfo($p_header, &$p_info) { $v_result = PclZip::privConvertHeader2FileInfo($p_header, $p_info); if ($v_result === 1) { $p_info['compression'] = $p_header['compression']; } return $v_result; } }

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.0.120.0130.00013.54
8.0.110.0080.00413.47
8.0.100.0130.00013.39
8.0.90.0070.00613.38
8.0.80.0130.00013.44
8.0.70.0070.00613.47
8.0.60.0040.00813.50
8.0.50.0000.01313.41
8.0.30.0120.00013.39
8.0.20.0100.00313.48
8.0.10.0120.00013.55
8.0.00.0000.00713.50
7.4.250.0090.00013.43
7.4.240.0070.00713.39
7.4.230.0140.00013.35
7.4.220.0000.01213.20
7.4.210.0110.00313.35
7.4.200.0090.00413.35
7.4.190.0000.01313.33
7.4.180.0030.00313.36
7.4.160.0060.00013.46
7.4.150.0070.00013.31
7.4.140.0080.00013.26
7.4.130.0080.00413.19
7.4.120.0100.00213.32
7.4.110.0090.00413.18
7.4.100.0140.00013.44
7.4.90.0030.01013.16
7.4.80.0130.00013.21
7.4.70.0130.00013.18
7.4.60.0070.00713.21
7.4.50.0080.00513.12
7.4.40.0070.00713.00
7.4.30.0120.00013.11
7.4.20.0090.00313.16
7.4.10.0060.00814.04
7.4.00.0100.00614.31
7.3.310.0080.00513.24
7.3.300.0120.00013.17
7.3.290.0050.00313.36
7.3.280.0120.00313.38
7.3.270.0070.00713.34
7.3.260.0140.00013.26
7.3.250.0110.00313.20
7.3.240.0130.00013.26
7.3.230.0140.00013.40
7.3.220.0160.00013.31
7.3.210.0150.00613.31
7.3.200.0110.00413.30
7.3.190.0130.00313.35
7.3.180.0130.00513.23
7.3.170.0130.00313.20
7.3.160.0100.00313.31
7.3.150.0050.00513.32
7.3.140.0070.00213.18
7.3.130.0050.00714.20
7.3.120.0030.01114.28
7.3.110.0050.01014.36
7.3.100.0080.00514.24
7.3.90.0040.00714.26
7.3.80.0050.00714.40
7.3.70.0040.00814.28
7.3.60.0050.00714.23
7.3.50.0030.00714.28
7.3.40.0050.00514.18
7.3.30.0050.00414.20
7.3.20.0030.00916.11
7.3.10.0050.00716.18
7.3.00.0060.00416.01
7.2.340.0070.00613.32
7.2.330.0080.00513.14
7.2.320.0130.00013.17
7.2.310.0100.00313.34
7.2.300.0080.00513.33
7.2.290.0100.00313.24
7.2.280.0040.00813.13
7.2.270.0000.01313.14
7.2.260.0050.01114.01
7.2.250.0050.01014.44
7.2.240.0100.00514.44
7.2.230.0090.00314.32
7.2.220.0080.00614.31
7.2.210.0090.00214.35
7.2.200.0060.00714.49
7.2.190.0060.00814.27
7.2.180.0080.00614.28
7.2.170.0070.00714.38
7.2.160.0060.00714.15
7.2.150.0100.00516.08
7.2.140.0050.00915.88
7.2.130.0060.00516.12
7.2.120.0050.01015.96
7.2.110.0090.00216.00
7.2.100.0080.00515.94
7.2.90.0050.01016.13
7.2.80.0010.01115.99
7.2.70.0100.00516.01
7.2.60.0070.00716.26
7.2.50.0040.00916.08
7.2.40.0080.00616.09
7.2.30.0060.00815.96
7.2.20.0060.00816.00
7.2.10.0040.01015.96
7.2.00.0060.00717.01
7.1.330.0090.00415.12
7.1.320.0060.00615.17
7.1.310.0020.00915.26
7.1.300.0060.00615.16
7.1.290.0070.00815.09
7.1.280.0070.00515.17
7.1.270.0060.00414.96
7.1.260.0090.00715.17
7.1.250.0070.00415.07
7.1.240.0090.00314.88
7.1.230.0030.00914.97
7.1.220.0060.00615.06
7.1.210.0090.00514.97
7.1.200.0050.00815.25
7.1.190.0080.00514.97
7.1.180.0060.00614.99
7.1.170.0070.00615.02
7.1.160.0050.00614.89
7.1.150.0100.00114.84
7.1.140.0080.00514.95
7.1.130.0070.00514.83
7.1.120.0050.00614.86
7.1.110.0070.00615.03
7.1.100.0100.00315.94
7.1.90.0080.00514.99
7.1.80.0060.00914.91
7.1.70.0050.00715.65
7.1.60.0070.00615.71
7.1.50.0100.00815.49
7.1.40.0080.00615.06
7.1.30.0060.00814.92
7.1.20.0090.00415.01
7.1.10.0080.00614.91
7.1.00.0060.02817.26
7.0.330.0080.00514.66
7.0.320.0090.00314.71
7.0.310.0060.00814.81
7.0.300.0070.00514.82
7.0.290.0060.00714.69
7.0.280.0090.00314.77
7.0.270.0080.00514.70
7.0.260.0060.00414.72
7.0.250.0060.00514.86
7.0.240.0060.00814.65
7.0.230.0060.00714.82
7.0.220.0080.00714.83
7.0.210.0070.00714.75
7.0.200.0070.00515.25
7.0.190.0120.00014.71
7.0.180.0090.00314.76
7.0.170.0090.00314.88
7.0.160.0070.00514.79
7.0.150.0070.00514.59
7.0.140.0070.02617.22
7.0.130.0070.00414.73
7.0.120.0060.00614.77
7.0.110.0110.00314.70
7.0.100.0070.00314.61
7.0.90.0070.00514.75
7.0.80.0070.02716.53
7.0.70.0080.02216.53
7.0.60.0060.02316.50
7.0.50.0070.03116.52
7.0.40.0010.02515.81
7.0.30.0080.01815.79
7.0.20.0090.01915.79
7.0.10.0050.02915.85
7.0.00.0050.03415.84
5.6.400.0040.00613.30
5.6.390.0090.00513.46
5.6.380.0080.00513.56
5.6.370.0040.01013.63
5.6.360.0090.00513.63
5.6.350.0040.00913.54
5.6.340.0090.00213.42
5.6.330.0030.00913.39
5.6.320.0050.00713.49
5.6.310.0070.00413.62
5.6.300.0040.00913.40
5.6.290.0070.00613.35
5.6.280.0070.02615.99
5.6.270.0050.00513.45
5.6.260.0110.00313.20
5.6.250.0030.00713.20
5.6.240.0040.00713.28
5.6.230.0110.01515.79
5.6.220.0050.02915.74
5.6.210.0080.01815.90
5.6.200.0080.02815.83
5.6.190.0070.03115.94
5.6.180.0060.03115.85
5.6.170.0070.03115.99
5.6.160.0070.03316.01
5.6.150.0060.02716.05
5.6.140.0050.02915.88
5.6.130.0100.03015.89
5.6.120.0110.01715.88
5.6.110.0060.03115.89
5.6.100.0080.03015.88
5.6.90.0080.02815.94
5.6.80.0040.03215.72
5.6.70.0090.02915.80
5.6.60.0060.02115.73
5.6.50.0110.02615.72
5.6.40.0070.03015.80
5.6.30.0060.03015.75
5.6.20.0140.01715.70
5.6.10.0110.02415.66
5.6.00.0100.02615.61
5.5.380.0040.00813.56
5.5.370.0030.02715.79
5.5.360.0030.03315.63
5.5.350.0050.03215.58
5.5.340.0070.03115.75
5.5.330.0110.02515.86
5.5.320.0080.02815.96
5.5.310.0100.02815.88
5.5.300.0100.02815.72
5.5.290.0060.02915.68
5.5.280.0100.02715.81
5.5.270.0060.03415.72
5.5.260.0090.02015.77
5.5.250.0090.02915.78
5.5.240.0090.02315.62
5.5.230.0080.02915.58
5.5.220.0070.02415.64
5.5.210.0070.02615.58
5.5.200.0130.01815.57
5.5.190.0070.01715.52
5.5.180.0070.02915.57
5.5.170.0080.00513.48
5.5.160.0110.01715.61
5.5.150.0070.02015.67
5.5.140.0110.02615.57
5.5.130.0060.02915.61
5.5.120.0070.02715.48
5.5.110.0030.03315.62
5.5.100.0060.01915.56
5.5.90.0040.01915.53
5.5.80.0040.03215.56
5.5.70.0060.02815.39
5.5.60.0070.02715.62
5.5.50.0080.02915.55
5.5.40.0090.02615.64
5.5.30.0080.02315.63
5.5.20.0070.02015.67
5.5.10.0080.02615.51
5.5.00.0140.02515.42
5.4.450.0070.01814.78
5.4.440.0080.01514.78
5.4.430.0090.02714.90
5.4.420.0080.02914.95
5.4.410.0030.03114.86
5.4.400.0090.02614.75
5.4.390.0040.02214.72
5.4.380.0050.02014.76
5.4.370.0050.01614.72
5.4.360.0080.01914.77
5.4.350.0050.03014.78
5.4.340.0040.02014.83
5.4.330.0070.00212.68
5.4.320.0090.02114.91
5.4.310.0030.02814.74
5.4.300.0050.02814.88
5.4.290.0060.02814.77
5.4.280.0060.02414.80
5.4.270.0070.02614.76
5.4.260.0040.03014.82
5.4.250.0080.02614.74
5.4.240.0070.02614.78
5.4.230.0110.02114.74
5.4.220.0050.02114.79
5.4.210.0030.03014.77
5.4.200.0050.01914.80
5.4.190.0030.02814.78
5.4.180.0080.01414.77
5.4.170.0060.02614.86
5.4.160.0070.02814.79
5.4.150.0100.01714.78
5.4.140.0080.02813.86
5.4.130.0080.02313.91
5.4.120.0070.01413.92
5.4.110.0040.02713.98
5.4.100.0070.01513.94
5.4.90.0020.02713.94
5.4.80.0070.02613.97
5.4.70.0070.02613.96
5.4.60.0130.02413.84
5.4.50.0050.02013.96
5.4.40.0040.01913.90
5.4.30.0110.02113.92
5.4.20.0080.02813.95
5.4.10.0040.02413.96
5.4.00.0040.01913.67
5.3.290.0040.03314.01
5.3.280.0100.03713.81
5.3.270.0050.04013.90
5.3.260.0050.03013.75
5.3.250.0080.03713.82
5.3.240.0090.01813.77
5.3.230.0080.03713.78
5.3.220.0070.02513.76
5.3.210.0070.04013.64
5.3.200.0070.02313.76
5.3.190.0130.02513.70
5.3.180.0070.02313.84
5.3.170.0050.02713.88
5.3.160.0090.03313.76
5.3.150.0040.02813.80
5.3.140.0070.02313.67
5.3.130.0020.04513.85
5.3.120.0100.04013.83
5.3.110.0070.02213.80
5.3.100.0040.02313.62
5.3.90.0050.02213.63
5.3.80.0070.02313.54
5.3.70.0050.02213.49
5.3.60.0090.01813.48
5.3.50.0060.02313.47
5.3.40.0020.03013.43
5.3.30.0050.02013.40
5.3.20.0030.02213.18
5.3.10.0040.02013.24
5.3.00.0050.01813.18
5.2.170.0040.01911.60
5.2.160.0040.01711.65
5.2.150.0040.01511.52
5.2.140.0050.01411.52
5.2.130.0080.01211.61
5.2.120.0060.01711.50
5.2.110.0000.02011.48
5.2.100.0020.01611.45
5.2.90.0120.00711.43
5.2.80.0030.02111.47
5.2.70.0000.02011.45
5.2.60.0020.02611.28
5.2.50.0040.01511.51
5.2.40.0050.01811.50
5.2.30.0070.01911.37
5.2.20.0050.02811.42
5.2.10.0030.01611.27
5.2.00.0010.01811.07
5.1.60.0050.01310.43
5.1.50.0040.02210.51
5.1.40.0040.01310.60
5.1.30.0030.01510.71
5.1.20.0040.01510.59
5.1.10.0040.01310.55
5.1.00.0040.01310.42
5.0.50.0020.0109.58
5.0.40.0030.0109.42
5.0.30.0050.0139.38
5.0.20.0020.0119.29
5.0.10.0020.0199.40
5.0.00.0020.0189.35
4.4.90.0020.0098.98
4.4.80.0040.0078.98
4.4.70.0050.0058.98
4.4.60.0020.0108.98
4.4.50.0000.0108.98
4.4.40.0030.0138.98
4.4.30.0000.0148.98
4.4.20.0020.0088.98
4.4.10.0000.0108.98
4.4.00.0000.0138.98
4.3.110.0020.0078.98
4.3.100.0020.0088.98
4.3.90.0020.0098.98
4.3.80.0020.0128.98
4.3.70.0020.0078.98
4.3.60.0020.0078.98
4.3.50.0020.0178.98
4.3.40.0040.0238.98
4.3.30.0010.0078.98
4.3.20.0030.0068.98
4.3.10.0000.0188.98
4.3.00.0010.0078.98

preferences:
39.85 ms | 401 KiB | 5 Q