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 = null) { $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.0060.00613.55
8.0.110.0060.00613.48
8.0.100.0120.00013.39
8.0.90.0130.00013.45
8.0.80.0000.01213.50
8.0.70.0090.00313.45
8.0.60.0100.00213.47
8.0.50.0040.00813.49
8.0.30.0050.00713.42
8.0.20.0080.00413.50
8.0.10.0060.00613.42
8.0.00.0040.00413.50
7.4.250.0080.00013.32
7.4.240.0140.00013.26
7.4.230.0090.00513.32
7.4.220.0120.00013.35
7.4.210.0120.00013.32
7.4.200.0080.00413.22
7.4.190.0060.00613.32
7.4.180.0030.00513.38
7.4.160.0030.00313.38
7.4.150.0030.00313.33
7.4.140.0050.00313.27
7.4.130.0130.00013.21
7.4.120.0000.01113.19
7.4.110.0100.00313.16
7.4.100.0100.00313.32
7.4.90.0080.00413.27
7.4.80.0130.00013.17
7.4.70.0000.01213.20
7.4.60.0070.00713.18
7.4.50.0080.00513.00
7.4.40.0100.00312.93
7.4.30.0120.00013.07
7.4.20.0050.00013.04
7.4.10.0000.00613.25
7.4.00.0020.01314.38
7.3.310.0000.00613.34
7.3.300.0000.00513.38
7.3.290.0060.00013.42
7.3.280.0000.00513.18
7.3.270.0000.00513.27
7.3.260.0030.00313.41
7.3.250.0000.00513.38
7.3.240.0000.00513.23
7.3.230.0000.00513.37
7.3.220.0000.00513.25
7.3.210.0050.00013.20
7.3.200.0030.00313.42
7.3.190.0000.00613.34
7.3.180.0030.00313.27
7.3.170.0000.00513.39
7.3.160.0050.00013.33
7.3.150.0050.00013.30
7.3.140.0030.00313.28
7.3.130.0000.00513.32
7.3.120.0060.01014.28
7.3.110.0030.01114.22
7.3.100.0060.00614.30
7.3.90.0050.00914.52
7.3.80.0040.00614.38
7.3.70.0030.00514.35
7.3.60.0060.00414.43
7.3.50.0030.00714.34
7.3.40.0050.00414.42
7.3.30.0090.00314.26
7.3.20.0030.00616.12
7.3.10.0040.00616.16
7.3.00.0060.00516.13
7.2.340.0000.01113.21
7.2.330.0060.00613.28
7.2.320.0080.00413.17
7.2.310.0130.00013.31
7.2.300.0060.00613.12
7.2.290.0090.00313.30
7.2.280.0120.00013.34
7.2.270.0090.00313.18
7.2.260.0090.00413.17
7.2.250.0050.01214.45
7.2.240.0040.01214.44
7.2.230.0070.00714.52
7.2.220.0100.00614.24
7.2.210.0080.00814.53
7.2.200.0070.00614.49
7.2.190.0100.00514.48
7.2.180.0090.00414.35
7.2.170.0060.00714.46
7.2.160.0080.00413.43
7.2.150.0100.00315.21
7.2.140.0040.00815.17
7.2.130.0130.00015.41
7.2.120.0060.00615.09
7.2.110.0100.00315.27
7.2.100.0130.00015.11
7.2.90.0100.00315.27
7.2.80.0090.00315.24
7.2.70.0130.00015.21
7.2.60.0080.00616.04
7.2.50.0100.00315.05
7.2.40.0130.00015.24
7.2.30.0110.00315.26
7.2.20.0080.00515.17
7.2.10.0090.00415.10
7.2.00.0110.00217.18
7.1.330.0070.00615.20
7.1.320.0090.00615.19
7.1.310.0070.00715.24
7.1.300.0070.00515.26
7.1.290.0050.00915.22
7.1.280.0090.00415.15
7.1.270.0060.00615.27
7.1.260.0070.00415.25
7.1.250.0040.00814.14
7.1.240.0090.00414.06
7.1.230.0120.00014.21
7.1.220.0080.00414.23
7.1.210.0100.00214.23
7.1.200.0090.00314.90
7.1.190.0130.00014.10
7.1.180.0090.00314.15
7.1.170.0060.00614.22
7.1.160.0000.01314.11
7.1.150.0100.00214.09
7.1.140.0040.00813.99
7.1.130.0040.00814.22
7.1.120.0040.00813.99
7.1.110.0100.00314.24
7.1.100.0080.00416.15
7.1.90.0000.01214.21
7.1.80.0060.00614.27
7.1.70.0070.00315.56
7.1.60.0100.00816.83
7.1.50.0170.00824.21
7.1.40.0080.00414.28
7.1.30.0120.00014.07
7.1.20.0120.00014.16
7.1.10.0060.00614.14
7.1.00.0050.04018.29
7.0.330.0120.00014.17
7.0.320.0070.00714.18
7.0.310.0120.00014.17
7.0.300.0080.00314.05
7.0.290.0080.00414.18
7.0.280.0090.00214.16
7.0.270.0100.00213.99
7.0.260.0110.00014.18
7.0.250.0060.00614.23
7.0.240.0080.00414.12
7.0.230.0130.00014.26
7.0.220.0100.00214.21
7.0.210.0080.00413.95
7.0.200.0070.00415.33
7.0.190.0070.00514.05
7.0.180.0130.00014.18
7.0.170.0050.00914.23
7.0.160.0120.00014.10
7.0.150.0120.00014.15
7.0.140.0050.04118.05
7.0.130.0060.00614.17
7.0.120.0090.00214.21
7.0.110.0060.00614.11
7.0.100.0100.00214.12
7.0.90.0000.01113.95
7.0.80.0110.04516.98
7.0.70.0110.04216.96
7.0.60.0130.03317.11
7.0.50.0180.04117.13
7.0.40.0120.03917.19
7.0.30.0100.04217.05
7.0.20.0050.02817.08
7.0.10.0150.03417.08
7.0.00.0070.04417.05
5.6.400.0000.00812.63
5.6.390.0080.00412.83
5.6.380.0090.00312.47
5.6.370.0120.00012.85
5.6.360.0110.00012.41
5.6.350.0070.00512.67
5.6.340.0090.00312.71
5.6.330.0110.00012.66
5.6.320.0060.00612.68
5.6.310.0060.00612.52
5.6.300.0120.00012.52
5.6.290.0070.00512.66
5.6.280.0040.04016.77
5.6.270.0060.00612.82
5.6.260.0080.00312.72
5.6.250.0000.01212.47
5.6.240.0080.00312.66
5.6.230.0080.03116.71
5.6.220.0090.03016.67
5.6.210.0110.04416.68
5.6.200.0190.02516.80
5.6.190.0090.03816.92
5.6.180.0080.03416.79
5.6.170.0080.04616.90
5.6.160.0050.04416.79
5.6.150.0100.03216.94
5.6.140.0110.02417.00
5.6.130.0090.04016.72
5.6.120.0050.04416.79
5.6.110.0070.04116.91
5.6.100.0030.02916.84
5.6.90.0030.02616.75
5.6.80.0090.01816.57
5.6.70.0030.02416.57
5.6.60.0020.02316.58
5.6.50.0080.02016.45
5.6.40.0070.02016.58
5.6.30.0050.02216.63
5.6.20.0080.03916.52
5.6.10.0070.02316.63
5.6.00.0060.02016.40
5.5.380.0080.00412.49
5.5.370.0110.04116.62
5.5.360.0110.04016.46
5.5.350.0030.03016.47
5.5.340.0130.02816.69
5.5.330.0110.04216.69
5.5.320.0070.04016.65
5.5.310.0090.03016.53
5.5.300.0090.04016.60
5.5.290.0050.03716.73
5.5.280.0050.04416.71
5.5.270.0070.03716.77
5.5.260.0070.02916.77
5.5.250.0050.03116.67
5.5.240.0090.02216.41
5.5.230.0060.02116.39
5.5.220.0050.02216.38
5.5.210.0020.02516.39
5.5.200.0050.02316.29
5.5.190.0100.01516.26
5.5.180.0030.02416.38
5.5.170.0110.00012.56
5.5.160.0050.02716.44
5.5.150.0050.01916.41
5.5.140.0050.03516.29
5.5.130.0030.02616.44
5.5.120.0090.02516.42
5.5.110.0000.03016.21
5.5.100.0050.02116.33
5.5.90.0040.02116.32
5.5.80.0050.02716.35
5.5.70.0060.02816.31
5.5.60.0070.02316.31
5.5.50.0060.02116.33
5.5.40.0040.02116.34
5.5.30.0070.03816.36
5.5.20.0070.02016.32
5.5.10.0030.02216.12
5.5.00.0040.02316.29
5.4.450.0060.03916.00
5.4.440.0060.04115.85
5.4.430.0050.02315.95
5.4.420.0030.03515.90
5.4.410.0090.01815.92
5.4.400.0090.02015.79
5.4.390.0080.01915.74
5.4.380.0060.02115.66
5.4.370.0040.02215.83
5.4.360.0060.02015.86
5.4.350.0040.02115.85
5.4.340.0050.02215.85
5.4.330.0080.00412.64
5.4.320.0050.02315.88
5.4.310.0060.02315.91
5.4.300.0090.02215.72
5.4.290.0070.02815.80
5.4.280.0070.01915.93
5.4.270.0050.01915.81
5.4.260.0050.02015.79
5.4.250.0100.03015.82
5.4.240.0050.02015.79
5.4.230.0080.02315.80
5.4.220.0030.02215.83
5.4.210.0050.02015.57
5.4.200.0120.01515.70
5.4.190.0050.02015.76
5.4.180.0060.02115.87
5.4.170.0030.02815.90
5.4.160.0050.02015.77
5.4.150.0050.02015.62
5.4.140.0050.01914.54
5.4.130.0070.01714.32
5.4.120.0030.01914.56
5.4.110.0040.02214.57
5.4.100.0030.02314.57
5.4.90.0070.02014.53
5.4.80.0070.01514.47
5.4.70.0070.01614.54
5.4.60.0090.02214.59
5.4.50.0100.03314.46
5.4.40.0070.03314.48
5.4.30.0080.01814.58
5.4.20.0070.03014.37
5.4.10.0090.01714.33
5.4.00.0040.01914.21
5.3.290.0030.02314.00
5.3.280.0070.01713.81
5.3.270.0070.01813.74
5.3.260.0050.02113.94
5.3.250.0070.02013.96
5.3.240.0020.02913.77
5.3.230.0050.01813.75
5.3.220.0040.02513.76
5.3.210.0060.01813.72
5.3.200.0070.01813.70
5.3.190.0060.02813.74
5.3.180.0020.02413.79
5.3.170.0050.02113.78
5.3.160.0040.02713.77
5.3.150.0080.03013.77
5.3.140.0080.03613.75
5.3.130.0040.02313.87
5.3.120.0100.03513.80
5.3.110.0070.03013.83
5.3.100.0100.03313.47
5.3.90.0090.03513.59
5.3.80.0070.03813.61
5.3.70.0100.03213.54
5.3.60.0000.02913.44
5.3.50.0070.03513.45
5.3.40.0110.03613.35
5.3.30.0110.02813.45
5.3.20.0110.03513.26
5.3.10.0100.03213.34
5.3.00.0050.04113.25
5.2.170.0030.02911.62
5.2.160.0050.03011.62
5.2.150.0000.03811.62
5.2.140.0060.01811.56
5.2.130.0040.01911.61
5.2.120.0020.03111.53
5.2.110.0060.03011.51
5.2.100.0070.01711.47
5.2.90.0040.01911.58
5.2.80.0060.02011.39
5.2.70.0050.02311.35
5.2.60.0060.01811.34
5.2.50.0100.02811.45
5.2.40.0030.03811.55
5.2.30.0040.03311.38
5.2.20.0060.03011.43
5.2.10.0050.02811.16
5.2.00.0070.03111.10
5.1.60.0030.02310.51
5.1.50.0050.02910.37
5.1.40.0020.02510.51
5.1.30.0080.01510.71
5.1.20.0070.02810.67
5.1.10.0040.02010.66
5.1.00.0040.02310.56
5.0.50.0080.0179.49
5.0.40.0030.0239.42
5.0.30.0000.0329.29
5.0.20.0030.0229.31
5.0.10.0030.0179.38
5.0.00.0020.0339.35
4.4.90.0020.0098.94
4.4.80.0020.0178.94
4.4.70.0030.0188.94
4.4.60.0020.0138.94
4.4.50.0020.0208.94
4.4.40.0030.0158.94
4.4.30.0020.0208.94
4.4.20.0020.0158.94
4.4.10.0020.0128.94
4.4.00.0050.0228.94
4.3.110.0000.0208.94
4.3.100.0070.0138.94
4.3.90.0050.0128.94
4.3.80.0020.0258.94
4.3.70.0030.0128.94
4.3.60.0020.0158.94
4.3.50.0030.0138.94
4.3.40.0050.0238.94
4.3.30.0000.0158.94
4.3.20.0000.0188.94
4.3.10.0060.0108.94
4.3.00.0050.0158.94

preferences:
40.66 ms | 401 KiB | 5 Q