3v4l.org

run code in 300+ PHP versions simultaneously
<?php function validate_utf8() { return (bool)preg_match('//u', serialize(func_get_args())); } function test($input) { $output = htmlspecialchars($input, ENT_QUOTES, 'UTF-8'); $code = str_replace('%', '\\x', rawurlencode($input)); if (validate_utf8($input)) { echo "【{$output}】({$code}) は有効なUTF-8シーケンスです。\n"; } else { echo "({$code}) は無効なUTF-8シーケンスです。\n"; } } test("☝( ◠‿◠ )☝"); test("ゔ〲〰"); test("\x0a\x92\xff"); // てきとー test("\xef\xbb\xbf"); // BOMだっけ test(""); // 空文字 echo "\n"; test("\x2f"); // スラッシュ(1バイト) test("\xc0\xaf"); // スラッシュ(冗長2バイト) test("\xe0\x80\xaf"); // スラッシュ(冗長3バイト) test("\xf0\x80\x80\xaf"); // スラッシュ(冗長4バイト)

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.1.70.0030.00317.64
8.1.60.0040.00417.62
8.1.50.0090.00017.61
8.1.40.0080.00017.51
8.1.30.0060.00317.84
8.1.20.0000.00817.74
8.1.10.0040.00417.69
8.1.00.0000.00717.65
8.0.200.0000.00717.08
8.0.190.0040.00417.10
8.0.180.0000.00816.98
8.0.170.0060.00317.08
8.0.160.0040.00416.98
8.0.150.0090.00017.05
8.0.140.0060.00317.11
8.0.130.0030.00313.54
8.0.120.0000.00817.06
8.0.110.0040.00416.98
8.0.100.0040.00417.14
8.0.90.0040.00417.15
8.0.80.0110.01117.09
8.0.70.0020.00516.93
8.0.60.0040.00417.14
8.0.50.0030.00517.17
8.0.30.0100.01017.22
8.0.20.0150.00717.25
8.0.10.0050.00317.21
8.0.00.0140.00616.85
7.4.300.0070.00016.82
7.4.290.0020.00516.76
7.4.280.0040.00416.75
7.4.270.0000.00616.73
7.4.260.0060.00013.45
7.4.250.0000.00816.71
7.4.240.0000.00716.84
7.4.230.0070.00016.52
7.4.220.0090.00916.93
7.4.210.0080.00916.80
7.4.200.0000.00716.74
7.4.190.0040.00416.80
7.4.160.0090.00616.79
7.4.150.0100.01016.69
7.4.140.0120.00916.82
7.4.130.0090.01216.75
7.4.120.0100.01016.66
7.4.110.0100.01016.78
7.4.100.0060.01116.60
7.4.90.0030.01416.63
7.4.80.0100.00716.71
7.4.70.0030.01716.56
7.4.60.0140.00416.70
7.4.50.0040.00416.61
7.4.40.0050.00916.65
7.4.30.0120.00616.65
7.4.00.0090.00715.25
7.3.330.0030.00313.60
7.3.320.0000.00513.54
7.3.310.0050.00216.40
7.3.300.0000.00716.55
7.3.290.0060.00916.53
7.3.280.0060.01116.50
7.3.270.0150.01516.70
7.3.260.0130.00816.69
7.3.250.0090.01016.56
7.3.240.0070.01016.62
7.3.230.0100.00716.48
7.3.210.0070.01016.80
7.3.200.0090.01219.39
7.3.190.0080.01416.80
7.3.180.0100.00716.80
7.3.170.0080.01516.51
7.3.160.0070.01116.54
7.3.120.0060.00915.07
7.3.110.0070.01115.04
7.3.100.0100.00315.08
7.3.90.0070.00714.72
7.3.80.0060.00915.13
7.3.70.0100.00314.99
7.3.60.0060.00915.09
7.3.50.0030.01414.85
7.3.40.0030.01414.94
7.3.30.0000.01414.92
7.3.20.0130.00316.87
7.3.10.0100.00316.91
7.3.00.0060.00916.51
7.2.330.0150.00316.75
7.2.320.0140.00316.83
7.2.310.0140.01516.89
7.2.300.0150.00816.81
7.2.290.0140.00316.77
7.2.250.0080.00815.36
7.2.240.0030.01615.32
7.2.230.0060.00914.89
7.2.220.0100.00615.18
7.2.210.0070.00715.34
7.2.200.0060.00615.05
7.2.190.0030.00715.33
7.2.180.0120.00315.13
7.2.170.0040.01115.32
7.2.00.0030.00619.78
7.1.330.0070.00715.84
7.1.320.0070.00715.82
7.1.310.0030.00716.08
7.1.300.0040.00416.13
7.1.290.0130.00315.92
7.1.280.0060.01015.87
7.1.270.0080.00315.92
7.1.260.0060.00315.98
7.1.70.0050.00217.52
7.1.60.0030.01719.40
7.1.50.0170.00317.05
7.1.00.0000.08022.59
7.0.200.0050.00216.97
7.0.140.0000.07022.11
7.0.120.0070.07022.03
7.0.110.0400.08720.07
7.0.100.0500.07320.11
7.0.90.0430.08320.02
7.0.80.0500.06720.02
7.0.70.0470.07319.89
7.0.60.0430.04719.93
7.0.50.0430.08720.05
7.0.40.0130.07019.74
7.0.30.0100.07319.60
7.0.20.0130.03719.73
7.0.10.0030.06019.71
7.0.00.0070.04019.88
5.6.280.0070.07020.86
5.6.260.0000.05320.73
5.6.250.0070.07020.51
5.6.240.0070.03320.64
5.6.230.0100.07720.69
5.6.220.0070.03320.59
5.6.210.0100.08020.54
5.6.200.0100.07020.66
5.6.190.0170.07020.86
5.6.180.0030.04320.62
5.6.170.0030.08320.55
5.6.160.0100.06720.71
5.6.150.0030.04320.65
5.6.140.0130.07720.65
5.6.130.0070.03320.56
5.6.120.0100.07720.61
5.6.110.0100.06720.58
5.6.100.0030.04020.54
5.6.90.0030.08320.57
5.6.80.0070.06320.02
5.6.70.0100.07319.85
5.6.60.0000.04320.04
5.6.50.0070.08020.24
5.6.40.0170.06719.92
5.6.30.0030.08719.98
5.6.20.0070.07320.00
5.6.10.0070.04319.98
5.6.00.0100.07319.83
5.5.380.0100.05017.59
5.5.370.0030.06717.68
5.5.360.0030.07317.68
5.5.350.0070.08017.54
5.5.340.0030.04718.23
5.5.330.0000.07718.22
5.5.320.0070.06018.13
5.5.310.0070.07718.13
5.5.300.0000.08017.83
5.5.290.0070.06018.22
5.5.280.0030.03718.09
5.5.270.0000.04018.13
5.5.260.0070.08017.81
5.5.250.0030.08017.89
5.5.240.0030.07717.61
5.5.230.0100.06317.63
5.5.220.0100.07017.50
5.5.210.0000.06017.63
5.5.200.0130.07317.31
5.5.190.0070.06017.57
5.5.180.0070.05317.57
5.5.160.0100.07317.57
5.5.150.0030.07717.41
5.5.140.0100.07017.48
5.5.130.0100.07317.28
5.5.120.0100.07317.45
5.5.110.0070.07017.47
5.5.100.0070.06717.33
5.5.90.0070.04017.10
5.5.80.0170.04717.38
5.5.70.0000.08317.38
5.5.60.0000.05017.47
5.5.50.0100.07017.37
5.5.40.0070.07017.20
5.5.30.0000.07017.36
5.5.20.0070.06717.33
5.5.10.0070.07717.31
5.5.00.0030.04317.15
5.4.450.0030.08019.64
5.4.440.0170.06019.55
5.4.430.0070.06319.33
5.4.420.0100.03019.66
5.4.410.0000.07019.21
5.4.400.0000.06719.34
5.4.390.0100.07018.99
5.4.380.0100.07719.00
5.4.370.0070.06719.00
5.4.360.0070.06719.03
5.4.350.0030.03719.16
5.4.340.0000.08319.16
5.4.320.0070.06719.18
5.4.310.0070.04019.01
5.4.300.0030.07719.00
5.4.290.0070.04319.14
5.4.280.0100.06319.31
5.4.270.0030.08019.14
5.4.260.0030.07319.22
5.4.250.0130.07018.94
5.4.240.0030.07719.18
5.4.230.0000.04019.31
5.4.220.0070.08019.30
5.4.210.0100.03319.00
5.4.200.0070.07018.98
5.4.190.0070.04018.96
5.4.180.0000.08719.25
5.4.170.0030.07319.02
5.4.160.0130.06319.32
5.4.150.0030.06319.07
5.4.140.0100.07016.60
5.4.130.0070.06016.61
5.4.120.0000.04016.61
5.4.110.0000.08016.46
5.4.100.0000.04316.37
5.4.90.0000.06316.48
5.4.80.0030.05716.51
5.4.70.0100.06316.47
5.4.60.0070.04316.44
5.4.50.0070.06016.38
5.4.40.0130.06316.61
5.4.30.0070.04016.53
5.4.20.0100.06716.60
5.4.10.0030.04316.43
5.4.00.0070.03315.93
5.3.290.0030.08014.67
5.3.280.0070.07014.63
5.3.270.0030.07314.61
5.3.260.0130.06714.70
5.3.250.0170.02714.56
5.3.240.0070.06314.64
5.3.230.0030.07314.60
5.3.220.0100.06014.67
5.3.210.0070.07714.58
5.3.200.0130.07014.70
5.3.190.0030.05314.43
5.3.180.0030.07014.56
5.3.170.0000.08014.57
5.3.160.0030.03714.58
5.3.150.0030.04314.55
5.3.140.0030.07714.58
5.3.130.0100.07314.79
5.3.120.0100.07314.63
5.3.110.0000.05014.63
5.3.100.0130.06314.07
5.3.90.0030.07314.00
5.3.80.0070.06714.01
5.3.70.0000.08014.10
5.3.60.0030.07314.14
5.3.50.0070.07013.97
5.3.40.0070.07013.93
5.3.30.0170.06313.98
5.3.20.0130.03313.70
5.3.10.0070.07313.79
5.3.00.0000.04313.67
5.2.170.0070.03311.92
5.2.160.0070.03711.92
5.2.150.0070.05711.92
5.2.140.0030.06711.92
5.2.130.0070.05711.92
5.2.120.0030.06011.92
5.2.110.0030.06311.92
5.2.100.0030.02711.92
5.2.90.0030.06011.92
5.2.80.0100.05711.92
5.2.70.0100.06011.92
5.2.60.0000.06711.92
5.2.50.0030.03711.92
5.2.40.0070.05711.92
5.2.30.0070.05711.92
5.2.20.0070.04311.92
5.2.10.0030.03311.92
5.2.00.0100.05311.92
5.1.60.0000.03311.92
5.1.50.0070.05011.92
5.1.40.0030.05311.92
5.1.30.0000.03311.92
5.1.20.0070.05011.92
5.1.10.0100.04711.92
5.1.00.0130.02011.92
5.0.50.0030.04711.92
5.0.40.0030.04011.92
5.0.30.0030.04311.92
5.0.20.0070.04011.92
5.0.10.0000.04711.92
5.0.00.0000.07011.92
4.4.90.0130.02311.92
4.4.80.0000.03711.92
4.4.70.0070.01311.92
4.4.60.0070.03011.92
4.4.50.0000.03311.92
4.4.40.0030.02311.92
4.4.30.0070.02311.92
4.4.20.0000.03711.92
4.4.10.0030.03311.92
4.4.00.0000.05011.92
4.3.110.0030.03311.92
4.3.100.0000.02011.92
4.3.90.0000.03011.92
4.3.80.0000.02311.92
4.3.70.0030.01311.92
4.3.60.0030.02011.92
4.3.50.0070.02711.92
4.3.40.0000.05311.92
4.3.30.0030.03311.92
4.3.20.0030.03311.92
4.3.10.0100.02311.92
4.3.00.0000.03011.92

preferences:
184.34 ms | 418 KiB | 26 Q