3v4l.org

run code in 300+ PHP versions simultaneously
<?php function lzw_decompress($binary) { $dictionary_count = 256; $bits = 8; $codes = array(); $rest = 0; $rest_length = 0; mb_internal_encoding("UTF-8"); for ($i = 0; $i < mb_strlen($binary); $i++ ) {$codes[] = mb_ord(mb_substr($binary, $i, 1)); } // decompression $dictionary = range("\0", "\xFF"); $return = ""; foreach ($codes as $i => $code) { $element = $dictionary[$code]; if (!isset($element)) $element = $word . $word[0]; $return .= $element; if ($i) $dictionary[] = $word . $element[0]; $word = $element; } return $return; } function mb_ord($string) { if (extension_loaded('mbstring') === true) { mb_language('Neutral'); mb_internal_encoding('UTF-8'); mb_detect_order(array('UTF-8', 'ISO-8859-15', 'ISO-8859-1', 'ASCII')); $result = unpack('N', mb_convert_encoding($string, 'UCS-4BE', 'UTF-8')); if (is_array($result) === true) return $result[1]; } return ord($string); } echo lzw_decompress('');

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.0100.01016.54
8.5.00.0130.00919.90
8.4.150.0030.00014.05
8.4.140.0090.01217.53
8.4.130.0070.00118.00
8.4.120.0110.00923.97
8.4.110.0130.00921.63
8.4.100.0140.00618.70
8.4.90.0030.00618.72
8.4.80.0060.01118.53
8.4.70.0130.00718.18
8.4.60.0080.01218.69
8.4.50.0120.00818.35
8.4.40.0100.01019.24
8.4.30.0130.00719.47
8.4.20.0100.01019.57
8.4.10.0100.00719.38
8.3.280.0130.00918.38
8.3.270.0120.00716.32
8.3.260.0080.00716.52
8.3.250.0110.00819.06
8.3.240.0090.00716.97
8.3.230.0130.00616.48
8.3.220.0140.00419.07
8.3.210.0050.00616.73
8.3.200.0080.00016.76
8.3.190.0060.00217.29
8.3.180.0130.00717.00
8.3.170.0140.00322.67
8.3.160.0040.01417.14
8.3.150.0100.01016.85
8.3.140.0040.00416.47
8.3.130.0040.00416.48
8.3.120.0110.00418.73
8.3.110.0090.00620.94
8.3.100.0050.00324.06
8.3.90.0080.00026.77
8.3.80.0090.00017.97
8.3.70.0120.00318.43
8.3.60.0100.01316.50
8.3.50.0120.00518.41
8.3.40.0090.00618.67
8.3.30.0110.00418.68
8.3.20.0040.00420.13
8.3.10.0040.00422.11
8.3.00.0040.00423.64
8.2.290.0110.00820.34
8.2.280.0100.01018.34
8.2.270.0120.00617.22
8.2.260.0000.00816.37
8.2.250.0080.00018.24
8.2.240.0050.00318.66
8.2.230.0040.00422.58
8.2.220.0080.00037.54
8.2.210.0150.00026.77
8.2.200.0060.00318.29
8.2.190.0070.00716.58
8.2.180.0140.00316.63
8.2.170.0110.00422.96
8.2.160.0030.01020.52
8.2.150.0070.00025.66
8.2.140.0000.00724.66
8.2.130.0040.00420.52
8.2.120.0000.00826.35
8.2.110.0070.00420.93
8.2.100.0090.00317.66
8.2.90.0060.00319.09
8.2.80.0040.00417.97
8.2.70.0040.00417.38
8.2.60.0040.00419.66
8.2.50.0000.00818.10
8.2.40.0030.00622.27
8.2.30.0050.00319.13
8.2.20.0060.00317.86
8.2.10.0090.00017.84
8.2.00.0000.00717.98
8.1.330.0080.01021.89
8.1.320.0130.00615.89
8.1.310.0080.00016.36
8.1.300.0120.00315.85
8.1.290.0030.00730.84
8.1.280.0100.00725.92
8.1.270.0080.00022.11
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00623.82
8.1.230.0040.00717.70
8.1.220.0050.00317.74
8.1.210.0030.00618.77
8.1.200.0030.00617.13
8.1.190.0000.00817.11
8.1.180.0040.00418.10
8.1.170.0000.00818.46
8.1.160.0070.00018.64
8.1.150.0000.00719.98
8.1.140.0080.00017.32
8.1.130.0090.00018.95
8.1.120.0000.00817.29
8.1.110.0080.00417.23
8.1.100.0000.00817.34
8.1.90.0070.00017.21
8.1.80.0030.00617.30
8.1.70.0030.00317.32
8.1.60.0060.00317.33
8.1.50.0040.00417.34
8.1.40.0110.00017.34
8.1.30.0100.00017.35
8.1.20.0000.00717.35
8.1.10.0080.00017.32
8.1.00.0040.00417.31
8.0.300.0000.00818.77
8.0.290.0000.00716.75
8.0.280.0020.00518.31
8.0.270.0040.00416.98
8.0.260.0000.00618.30
8.0.250.0070.00016.87
8.0.240.0030.00516.79
8.0.230.0000.00716.78
8.0.220.0070.00016.71
8.0.210.0030.00316.75
8.0.200.0030.00316.75
8.0.190.0000.00816.75
8.0.180.0040.00416.75
8.0.170.0030.00516.75
8.0.160.0030.00416.72
8.0.150.0030.00716.66
8.0.140.0040.00416.74
8.0.130.0030.00313.17
8.0.120.0000.00816.80
8.0.110.0000.00716.84
8.0.100.0040.00416.83
8.0.90.0000.00816.72
8.0.80.0060.01016.85
8.0.70.0070.00016.73
8.0.60.0000.00816.81
8.0.50.0070.00016.77
8.0.30.0090.01116.96
8.0.20.0100.01017.40
8.0.10.0040.00416.89
8.0.00.0040.01416.66
7.4.330.0050.00015.55
7.4.320.0030.00316.39
7.4.300.0000.00716.51
7.4.290.0000.01116.34
7.4.280.0070.00016.36
7.4.270.0020.00516.28
7.4.260.0070.00016.34
7.4.250.0040.00416.42
7.4.240.0030.00516.39
7.4.230.0000.00716.49
7.4.220.0000.01916.44
7.4.210.0060.00916.35
7.4.200.0000.00716.36
7.4.160.0060.01316.21
7.4.150.0080.00817.40
7.4.140.0120.00617.86
7.4.130.0070.01016.38
7.4.120.0120.00716.33
7.4.110.0030.01416.45
7.4.100.0080.00816.42
7.4.90.0090.00916.38
7.4.80.0120.00919.39
7.4.70.0070.01116.61
7.4.60.0130.00316.35
7.4.50.0140.00316.41
7.4.40.0070.01016.20
7.4.30.0130.00316.52
7.4.00.0090.00314.51
7.3.330.0000.00513.21
7.3.320.0000.00613.28
7.3.310.0000.00816.41
7.3.300.0030.00316.13
7.3.290.0050.00316.11
7.3.280.0080.00816.22
7.3.270.0130.00417.40
7.3.260.0130.00416.29
7.3.250.0140.00316.27
7.3.240.0080.00916.32
7.3.230.0100.00716.16
7.3.210.0140.00516.26
7.3.200.0100.00716.27
7.3.190.0070.01016.30
7.3.180.0130.00316.19
7.3.170.0040.01416.48
7.3.160.0040.01316.30
7.2.330.0060.01216.61
7.2.320.0090.00916.50
7.2.310.0150.00316.45
7.2.300.0130.00716.19
7.2.290.0170.00316.46
7.2.60.0100.00316.58
7.1.200.0080.00815.80
7.1.100.0170.01116.47
7.1.90.1920.00316.00
7.1.80.0100.01216.27
7.1.70.0150.01515.43
7.1.60.2580.01233.52
7.1.50.0210.01433.22
7.1.40.0290.01432.67
7.1.30.0730.01432.70
7.1.20.0230.01032.73
7.1.10.0330.00414.76
7.1.00.0580.00814.89
7.0.240.0240.00615.79
7.0.230.3040.01815.73
7.0.220.0100.01315.96
7.0.210.0210.00715.04
7.0.200.1110.00915.03
7.0.190.0090.00914.79
7.0.180.0120.00914.65
7.0.170.0090.01414.66
7.0.160.0150.00414.52
7.0.150.0120.01714.44
7.0.140.0110.00714.66
7.0.130.0150.01014.71
7.0.120.0080.00814.71
7.0.110.1060.00714.33
7.0.100.0130.00314.66
7.0.90.0090.00614.60
7.0.80.1530.00014.58
7.0.70.0220.00714.32
7.0.60.0080.00814.53
7.0.50.0110.00714.81
7.0.40.0030.01314.67
7.0.30.1480.01014.69
7.0.20.0160.01014.75
7.0.10.0110.01114.68
7.0.00.0670.00414.90

preferences:
166.23 ms | 403 KiB | 5 Q