3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('display_errors', '1'); // display runtime errors error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); // error reporting date_default_timezone_set('UTC'); function detect_encoding($ystr, $csetlist='UTF-8, ISO-8859-1, ISO-8859-15, ISO-8859-2, ISO-8859-9, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-10, ISO-8859-13, ISO-8859-14, ISO-8859-16, UTF-7, ASCII, SJIS, EUC-JP, JIS, ISO-2022-JP, EUC-CN, GB18030, ISO-2022-KR, KOI8-R, KOI8-U') { // Fix: starting from PHP 7.1 it warns about illegal argument if using: ISO-8859-11 return mb_detect_encoding((string)$ystr, (string)$csetlist, true); // mixed: (bool) FALSE or (string) 'CHARSET' } $str = 'A + B'; echo detect_encoding($str); echo "\n"; echo mb_convert_encoding($str, 'UTF-8', detect_encoding($str)); echo "\n"; echo "\n"; $str = 'A - B'; echo detect_encoding('A - B'); echo "\n"; echo mb_convert_encoding($str, 'UTF-8', detect_encoding($str));

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.4.120.0060.00420.25
8.4.110.0110.01122.53
8.4.100.0110.01017.95
8.4.90.0090.00217.64
8.4.80.0130.00718.08
8.4.70.0050.00318.00
8.4.60.0120.00818.57
8.4.50.0130.00717.56
8.4.40.0130.00719.46
8.4.30.0080.00020.53
8.4.20.0040.00422.52
8.4.10.0040.00425.86
8.3.250.0050.00318.73
8.3.240.0100.01016.48
8.3.230.0090.01016.56
8.3.220.0090.00917.09
8.3.210.0090.00916.60
8.3.200.0050.00416.63
8.3.190.0140.00617.33
8.3.180.0110.00916.93
8.3.170.0140.00319.18
8.3.160.0110.01116.54
8.3.150.0090.00919.00
8.3.140.0060.00317.04
8.3.130.0060.00316.48
8.3.120.0050.00320.73
8.3.110.0080.00018.34
8.3.100.0080.00016.80
8.3.90.0030.00526.77
8.3.80.0060.00318.38
8.3.70.0000.01416.75
8.3.60.0110.00418.30
8.3.50.0070.01018.55
8.3.40.0180.00420.52
8.3.30.0110.00418.67
8.3.20.0070.00024.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0110.00820.34
8.2.280.0080.01118.56
8.2.270.0120.00619.08
8.2.260.0000.00816.50
8.2.250.0090.00618.79
8.2.240.0060.00317.36
8.2.230.0040.00420.94
8.2.220.0060.00324.06
8.2.210.0140.00426.77
8.2.200.0060.00316.75
8.2.190.0060.01016.88
8.2.180.0180.00325.92
8.2.170.0050.01019.05
8.2.160.0090.00622.96
8.2.150.0030.00525.66
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0060.00326.16
8.2.110.0060.00319.39
8.2.100.0080.00417.91
8.2.90.0060.00318.05
8.2.80.0000.00817.88
8.2.70.0030.00617.88
8.2.60.0040.00418.29
8.2.50.0030.00518.07
8.2.40.0040.00420.07
8.2.30.0040.00418.19
8.2.20.0050.00219.57
8.2.10.0070.01117.89
8.2.00.0140.00217.88
8.1.330.0070.01218.67
8.1.320.0090.01016.36
8.1.310.0050.00218.75
8.1.300.0060.00318.52
8.1.290.0100.00030.84
8.1.280.0060.01525.92
8.1.270.0000.00824.66
8.1.260.0000.00826.35
8.1.250.0090.00028.09
8.1.240.0060.00322.67
8.1.230.0000.01121.04
8.1.220.0040.00417.78
8.1.210.0040.00419.02
8.1.200.0060.00317.60
8.1.190.0040.00417.61
8.1.180.0030.00618.80
8.1.170.0040.00418.79
8.1.160.0040.00419.09
8.1.150.0040.00418.77
8.1.140.0100.00317.60
8.1.130.0100.00517.56
8.1.120.0160.00017.73
8.1.110.0120.00417.70
8.1.100.0160.00517.75
8.1.90.0070.01317.84
8.1.80.0140.00217.79
8.1.70.0140.00217.75
8.1.60.0150.00417.84
8.1.50.0040.00817.84
8.1.40.0140.00017.76
8.1.30.0120.00417.86
8.1.20.0100.00317.84
8.1.10.0000.01217.75
8.1.00.0090.00317.77
8.0.300.0020.00520.16
8.0.290.0050.00316.58
8.0.280.0000.00718.51
8.0.270.0030.00616.86
8.0.260.0050.00516.95
8.0.250.0000.01017.03
8.0.240.0080.00416.94
8.0.230.0040.00816.91
8.0.220.0070.00316.83
8.0.210.0060.00416.91
8.0.200.0000.01116.96
8.0.190.0040.00816.96
8.0.180.0080.00516.86
8.0.170.0080.00416.88
8.0.160.0120.00917.07
8.0.150.0100.00317.01
8.0.140.0080.00816.78
8.0.130.0110.00416.90
8.0.120.0110.00316.93
8.0.110.0130.00316.82
8.0.100.0080.00816.79
8.0.90.0160.00016.79
8.0.80.0070.00716.81
8.0.70.0110.00416.75
8.0.60.0090.00716.77
8.0.50.0000.01316.80
8.0.30.0100.00516.95
8.0.20.0040.00816.94
8.0.10.0070.00317.13

preferences:
28.22 ms | 403 KiB | 5 Q