3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Sample generation $sampleUTF8 = 'Here is some lovely Russian: На берегу пустынных волн Стоял он, дум великих полн, И вдаль глядел. Пред ним широко Река неслася; бедный чёлн По ней стремился одиноко. and something else: ԠѬΏݑޤ'; $sampleUTF16 = mb_convert_encoding($sampleUTF8, 'UTF-16', 'UTF-8'); /** * Detect Encoding * Attempts to identify the encoding of the subject string; returns the encoding as a string. * * @param string $subject * * @return string * @throws \RuntimeException Encoding could not be identified */ function detect(string $subject): string { if (mb_detect_encoding($subject, 'auto')) { return mb_detect_encoding($subject, 'ASCII, UTF-8, UTF-7, UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, SJIS, JIS, ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-10, ISO-8859-11, ISO-8859-12, ISO-8859-13, ISO-8859-14, ISO-8859-15, Windows-1251, Windows-1252, Windows-1254, BASE-64, UCS-2, UCS-2BE, UCS-2LE, UCS-4, UCS-4BE, UCS-4LE, CP51932, CP50222, CP50221, CP50220, CP950, CP936, CP932, CP866, CP850, auto', true); } else { throw new \RuntimeException('Could not identify the string\'s encoding.'); } } echo detect($sampleUTF16);

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.30.0080.01017.54
8.5.20.0110.00619.94
8.5.10.0100.01020.05
8.5.00.0100.01120.00
8.4.180.0070.01519.76
8.4.170.0100.01220.48
8.4.160.0110.01022.42
8.4.150.0090.00516.92
8.4.140.0140.00817.90
8.4.130.0100.01218.20
8.4.120.0130.00623.87
8.4.110.0110.01018.16
8.4.100.0110.01018.98
8.4.90.0090.01220.38
8.4.80.0050.00418.68
8.4.70.0130.00818.05
8.4.60.0040.00419.01
8.4.50.0080.00918.95
8.4.40.0070.01120.48
8.4.30.0060.00917.76
8.4.20.0130.00717.74
8.4.10.0110.00017.67
8.3.300.0080.01220.89
8.3.290.0150.00620.84
8.3.280.0130.00718.32
8.3.270.0120.00716.70
8.3.260.0110.00416.58
8.3.250.0100.00518.85
8.3.240.0110.00618.73
8.3.230.0130.00816.67
8.3.220.0100.00818.75
8.3.210.0110.00616.78
8.3.200.0050.00416.73
8.3.190.0030.00517.30
8.3.180.0110.00717.31
8.3.170.0060.01221.00
8.3.160.0120.00616.75
8.3.150.0040.01517.11
8.3.140.0080.00016.95
8.3.130.0050.00518.66
8.3.120.0080.00019.04
8.3.110.0050.00320.94
8.3.100.0030.00624.06
8.3.90.0040.00426.77
8.3.80.0030.00719.36
8.3.70.0110.00718.43
8.3.60.0070.01018.31
8.3.50.0120.00721.08
8.3.40.0150.00618.84
8.3.30.0100.01018.71
8.3.20.0050.00318.95
8.3.10.0030.00523.47
8.3.00.0000.00820.84
8.2.300.0100.01020.42
8.2.290.0110.00720.25
8.2.280.0130.00518.78
8.2.270.0110.00717.19
8.2.260.0060.00920.67
8.2.250.0080.00016.96
8.2.240.0090.00918.86
8.2.230.0050.00322.58
8.2.220.0090.00037.54
8.2.210.0080.00026.77
8.2.200.0050.00518.88
8.2.190.0090.00917.00
8.2.180.0070.01116.88
8.2.170.0120.00322.96
8.2.160.0110.01119.46
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00421.12
8.2.120.0070.00026.35
8.2.110.0060.00319.43
8.2.100.0040.00717.72
8.2.90.0000.00819.28
8.2.80.0080.00019.48
8.2.70.0040.00417.75
8.2.60.0000.00818.04
8.2.50.0030.00618.07
8.2.40.0040.00418.05
8.2.30.0000.00818.04
8.2.20.0040.00417.78
8.2.10.0060.00318.35
8.2.00.0040.00418.28
8.1.340.0110.00820.19
8.1.330.0130.00522.04
8.1.320.0120.00918.28
8.1.310.0030.00616.45
8.1.300.0070.00416.35
8.1.290.0030.00630.84
8.1.280.0000.01625.92
8.1.270.0050.00323.83
8.1.260.0000.00728.09
8.1.250.0040.00428.09
8.1.240.0040.00422.09
8.1.230.0040.00820.89
8.1.220.0030.00617.79
8.1.210.0000.00818.85
8.1.200.0030.00617.47
8.1.190.0040.00417.48
8.1.180.0060.00318.10
8.1.170.0040.00418.59
8.1.160.0000.00818.87
8.1.150.0050.00319.04
8.1.140.0000.00719.73
8.1.130.0000.00717.72
8.1.120.0000.00717.56
8.1.110.0060.00317.56
8.1.100.0030.00417.46
8.1.90.0000.00817.61
8.1.80.0080.00017.48
8.1.70.0000.00717.42
8.1.60.0070.00017.58
8.1.50.0080.00017.57
8.1.40.0000.00917.48
8.1.30.0040.00417.72
8.1.20.0080.00017.63
8.1.10.0030.00617.56
8.1.00.0000.00817.51
8.0.300.0090.00020.34
8.0.290.0040.00417.00
8.0.280.0030.00518.61
8.0.270.0040.00417.38
8.0.260.0030.00317.25
8.0.250.0030.00317.15
8.0.240.0030.00317.10
8.0.230.0040.00417.16
8.0.220.0070.00017.08
8.0.210.0040.00417.05
8.0.200.0000.00617.04
8.0.190.0110.00017.11
8.0.180.0040.00417.03
8.0.170.0040.00417.13
8.0.160.0000.00717.14
8.0.150.0040.00416.98
8.0.140.0000.00717.07
8.0.130.0000.00513.46
8.0.120.0000.00817.06
8.0.110.0030.00616.96
8.0.100.0040.00416.89
8.0.90.0080.00017.18
8.0.80.0070.01017.08
8.0.70.0040.00416.97
8.0.60.0000.00717.07
8.0.50.0040.00417.01
8.0.30.0100.01117.18
8.0.20.0100.01117.42
8.0.10.0050.00317.25
8.0.00.0130.00816.93
7.4.330.0020.00215.08
7.4.320.0060.00016.69
7.4.300.0050.00216.62
7.4.290.0030.00316.67
7.4.280.0070.00016.61
7.4.270.0000.00716.66
7.4.260.0000.00716.67
7.4.250.0040.00416.82
7.4.240.0050.00216.78
7.4.230.0050.00216.68
7.4.220.0090.01216.79
7.4.210.0040.01116.60
7.4.200.0000.00716.51
7.4.160.0090.00616.66
7.4.150.0140.00417.40
7.4.140.0050.01317.86
7.4.130.0060.01116.56
7.4.120.0130.00716.71
7.4.110.0120.00616.72
7.4.100.0040.01516.52
7.4.90.0060.01116.59
7.4.80.0130.00619.39
7.4.70.0070.01016.75
7.4.60.0080.00816.73
7.4.50.0080.00316.59
7.4.40.0100.00616.60
7.4.30.0030.01316.65
7.4.00.0100.00714.97
7.3.330.0000.00713.59
7.3.320.0030.00313.53
7.3.310.0000.00716.33
7.3.300.0000.00816.56
7.3.290.0060.01116.47
7.3.280.0070.01116.47
7.3.270.0150.00317.40
7.3.260.0110.01116.54
7.3.250.0100.00816.50
7.3.240.0110.00716.54
7.3.230.0120.00916.66
7.3.210.0120.00416.73
7.3.200.0030.01316.67
7.3.190.0140.00316.52
7.3.180.0030.01316.57
7.3.170.0100.00716.57
7.3.160.0030.01316.69
7.2.330.0090.00916.81
7.2.320.0130.00316.85
7.2.310.0070.01016.71
7.2.300.0030.01316.75
7.2.290.0110.00616.75
7.2.60.0030.01016.70
7.1.200.0000.01415.57
7.1.70.0030.00617.33
7.1.60.0120.00620.41
7.1.50.0040.01816.73
7.1.00.0030.07722.26
7.0.200.0030.00617.07
7.0.60.0230.07321.66
7.0.50.0130.07317.88
7.0.40.0130.06020.18
7.0.30.0230.05320.10
7.0.20.0270.05320.30
7.0.10.0270.06020.16
7.0.00.0130.06320.31
5.6.280.0000.07721.13
5.6.210.0070.03720.61
5.6.200.0070.04318.14
5.6.190.0170.06020.46
5.6.180.0100.06320.45
5.6.170.0270.05320.46
5.6.160.0170.06320.61
5.6.150.0100.06320.59
5.6.140.0170.05720.28
5.6.130.0200.05720.44
5.6.120.0230.05020.42
5.6.110.0070.06020.40
5.6.100.0270.07720.29
5.6.90.0730.05720.32
5.6.80.0530.05319.86
5.6.70.0230.05019.68
5.6.60.0270.06019.79
5.6.50.0200.05019.61
5.6.40.0100.06319.64
5.6.30.0100.06319.66
5.6.20.0170.05719.79
5.6.10.0130.06719.71
5.6.00.0170.05719.79
5.5.350.0330.07020.50
5.5.340.0130.07317.95
5.5.330.0270.04720.38
5.5.320.0130.06020.41
5.5.310.0130.06320.52
5.5.300.0100.06720.09
5.5.290.0100.06320.20
5.5.280.0200.05020.22
5.5.270.0130.05720.18
5.5.260.0600.05020.00
5.5.250.0500.05019.82
5.5.240.0500.05719.49
5.5.230.0170.05319.61
5.5.220.0030.07019.55
5.5.210.0030.06719.76
5.5.200.0170.05319.57
5.5.190.0270.04319.49
5.5.180.0170.06019.36
5.5.160.0200.05019.56
5.5.150.0100.06319.57
5.5.140.0330.06019.57
5.5.130.0130.06019.47
5.5.120.0130.06019.46
5.5.110.0200.05019.73
5.5.100.0130.05719.45
5.5.90.0100.06019.49
5.5.80.0230.06019.46
5.5.70.0200.06319.25
5.5.60.0300.05019.46
5.5.50.0100.05719.48
5.5.40.0330.04719.32
5.5.30.0130.05719.36
5.5.20.0200.07019.41
5.5.10.0270.04719.35
5.5.00.0130.05719.52

preferences:
56.42 ms | 1666 KiB | 5 Q