3v4l.org

run code in 300+ PHP versions simultaneously
<?php $examples = array( 'Valid ASCII' => array("a", true), 'Valid 2 Octet Sequence' => array("\xc3\xb1", true), 'Invalid 2 Octet Sequence' => array("\xc3\x28", false), 'Invalid Sequence Identifier' => array("\xa0\xa1", false), 'Valid 3 Octet Sequence' => array("\xe2\x82\xa1", true), 'Invalid 3 Octet Sequence (in 2nd Octet)' => array("\xe2\x28\xa1", false), 'Invalid 3 Octet Sequence (in 3rd Octet)' => array("\xe2\x82\x28", false), 'Valid 4 Octet Sequence' => array("\xf0\x90\x8c\xbc", true), 'Invalid 4 Octet Sequence (in 2nd Octet)' => array("\xf0\x28\x8c\xbc", false), 'Invalid 4 Octet Sequence (in 3rd Octet)' => array("\xf0\x90\x28\xbc", false), 'Invalid 4 Octet Sequence (in 4th Octet)' => array("\xf0\x28\x8c\x28", false), 'Valid 5 Octet Sequence (but not Unicode!)' => array("\xf8\xa1\xa1\xa1\xa1", false), 'Valid 6 Octet Sequence (but not Unicode!)' => array("\xfc\xa1\xa1\xa1\xa1\xa1", false), ); function checkWithPreg($str) { return preg_match('//u', $str); } function checkWithMbstring($str) { return mb_check_encoding($str, 'UTF-8'); } function test($actual, $expected, $title) { echo $actual == $expected ? "[Success]" : "[Fail]"; echo " $title\n"; } function runTests($method) { global $examples; foreach($examples as $title => $arr) { list($str, $bool) = $arr; test($method($str), $bool, $title); } } echo "Checking with PCRE u modifier\n"; runTests('checkWithPreg'); echo "\n"; echo "Checking with mb_check_encoding\n"; runTests('checkWithMbstring');

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.3.60.0170.00716.74
8.3.50.0120.00822.17
8.3.40.0030.01218.89
8.3.30.0170.00018.67
8.3.20.0080.00019.02
8.3.10.0040.00421.04
8.3.00.0000.00823.41
8.2.180.0110.01116.86
8.2.170.0140.00722.96
8.2.160.0100.00320.53
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0000.00721.20
8.2.110.0040.01520.57
8.2.100.0120.00018.16
8.2.90.0000.00819.15
8.2.80.0040.00417.97
8.2.70.0030.00517.88
8.2.60.0040.00418.05
8.2.50.0040.00418.07
8.2.40.0040.00418.34
8.2.30.0040.00421.21
8.2.20.0030.00517.94
8.2.10.0030.00617.87
8.2.00.0040.00417.98
8.1.280.0110.00725.92
8.1.270.0040.00423.99
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0090.00022.60
8.1.230.0080.00320.79
8.1.220.0040.00418.77
8.1.210.0080.00018.85
8.1.200.0070.00317.61
8.1.190.0040.00417.64
8.1.180.0080.00018.10
8.1.170.0050.00318.72
8.1.160.0000.00718.96
8.1.150.0080.00018.80
8.1.140.0030.00517.63
8.1.130.0030.00517.74
8.1.120.0000.00717.73
8.1.110.0080.00017.65
8.1.100.0000.00817.75
8.1.90.0030.00517.63
8.1.80.0040.00417.60
8.1.70.0040.00417.58
8.1.60.0070.00417.83
8.1.50.0000.00817.73
8.1.40.0000.00817.84
8.1.30.0050.00317.95
8.1.20.0030.00517.84
8.1.10.0040.00417.80
8.1.00.0040.00417.77
8.0.300.0050.00319.99
8.0.290.0030.00517.43
8.0.280.0000.00718.56
8.0.270.0000.00817.29
8.0.260.0030.00317.04
8.0.250.0050.00317.26
8.0.240.0040.00417.16
8.0.230.0040.00417.15
8.0.220.0030.00617.16
8.0.210.0030.00317.17
8.0.200.0060.00017.17
8.0.190.0080.00017.10
8.0.180.0050.00317.23
8.0.170.0000.00817.13
8.0.160.0070.00017.19
8.0.150.0070.00017.00
8.0.140.0040.00417.16
8.0.130.0060.00013.67
8.0.120.0000.00717.07
8.0.110.0060.00317.14
8.0.100.0070.00017.11
8.0.90.0000.00817.06
8.0.80.0120.00317.27
8.0.70.0000.00717.07
8.0.60.0000.00717.27
8.0.50.0030.00617.24
8.0.30.0130.00617.45
8.0.20.0100.00917.42
8.0.10.0040.00517.03
8.0.00.0080.01017.01
7.4.330.0030.00314.93
7.4.320.0060.00016.82
7.4.300.0030.00316.86
7.4.290.0040.00416.95
7.4.280.0000.00716.75
7.4.270.0070.00016.93
7.4.260.0030.00313.50
7.4.250.0030.00616.70
7.4.240.0050.00216.91
7.4.230.0000.00716.93
7.4.220.0110.00517.02
7.4.210.0070.01016.92
7.4.200.0030.00316.78
7.4.190.0040.00416.96
7.4.160.0090.00916.78
7.4.150.0160.00317.40
7.4.140.0130.00817.86
7.4.130.0180.00316.85
7.4.120.0120.00816.86
7.4.110.0130.00316.81
7.4.100.0120.00616.67
7.4.90.0160.01017.00
7.4.80.0130.00719.39
7.4.70.0100.01016.78
7.4.60.0080.00816.71
7.4.50.0040.00416.58
7.4.40.0030.01322.52
7.4.30.0110.01116.89
7.4.00.0090.00615.10
7.3.330.0000.00513.70
7.3.320.0000.00513.46
7.3.310.0030.00316.70
7.3.300.0030.00316.52
7.3.290.0070.01416.64
7.3.280.0120.00516.68
7.3.270.0160.00317.40
7.3.260.0080.01618.24
7.3.250.0150.00616.67
7.3.240.0090.00916.89
7.3.230.0120.00616.91
7.3.210.0030.02016.89
7.3.200.0120.01119.39
7.3.190.0160.00816.89
7.3.180.0060.00916.73
7.3.170.0160.00016.52
7.3.160.0100.00616.72
7.3.120.0110.00415.28
7.3.10.0070.00716.92
7.3.00.0060.01016.92
7.2.330.0130.01016.90
7.2.320.0070.01016.90
7.2.310.0120.01016.72
7.2.300.0070.01016.68
7.2.290.0140.01116.77
7.2.130.0120.00017.27
7.2.120.0030.00917.00
7.2.110.0000.01317.29
7.2.100.0030.00717.13
7.2.90.0060.00917.21
7.2.80.0040.01117.23
7.2.70.0080.00417.23
7.2.60.0070.00717.17
7.2.50.0140.00317.14
7.2.40.0090.00317.08
7.2.30.0090.00917.02
7.2.20.0040.01117.11
7.2.10.0070.01017.22
7.2.00.0110.00418.45
7.1.250.0060.00816.11
7.1.200.0030.00716.06
7.1.100.0000.01318.54
7.1.70.0000.00717.38
7.1.60.0110.01419.40
7.1.50.0160.00617.40
7.1.00.0000.06722.37
7.0.200.0030.00517.02
7.0.140.0070.07022.07
7.0.70.0030.03321.75
7.0.60.0000.03321.71
7.0.50.0000.03322.14
7.0.40.0000.04019.96
7.0.30.0000.03720.09
7.0.20.0030.03320.00
7.0.10.0000.04720.12
7.0.00.0070.03720.05
5.6.280.0070.07020.83
5.6.220.0000.03320.64
5.6.210.0000.03320.43
5.6.200.0030.03321.11
5.6.190.0030.03021.18
5.6.180.0070.02721.05
5.6.170.0000.03321.18
5.6.160.0000.03721.07
5.6.150.0000.05021.07
5.6.140.0030.09021.18
5.6.130.0130.06021.05
5.6.120.0030.07721.14
5.6.110.0030.08021.02
5.6.100.0100.07721.11
5.6.90.0170.07320.91
5.6.80.0000.06320.57
5.6.70.0030.07020.50
5.6.60.0000.08720.45
5.6.50.0070.07720.41
5.6.40.0070.07720.31
5.6.30.0030.08320.32
5.6.20.0070.07720.45
5.6.10.0070.07020.30
5.6.00.0030.08320.44
5.5.360.0000.04020.46
5.5.350.0000.03320.39
5.5.340.0000.03320.80
5.5.330.0000.03320.93
5.5.320.0070.02720.77
5.5.310.0000.04020.89
5.5.300.0030.08020.94
5.5.290.0030.08320.65
5.5.280.0070.08020.93
5.5.270.0070.08320.65
5.5.260.0100.08020.80
5.5.250.0030.08020.70
5.5.240.0100.06020.26
5.5.230.0070.07020.25
5.5.220.0030.07320.25
5.5.210.0070.06320.12
5.5.200.0100.07720.13
5.5.190.0070.07720.28
5.5.180.0030.06720.17
5.5.160.0030.07720.27
5.5.150.0070.08020.26
5.5.140.0100.07020.29
5.5.130.0070.07320.13
5.5.120.0030.07320.24
5.5.110.0030.07720.09
5.5.100.0100.06720.14
5.5.90.0030.06719.96
5.5.80.0030.06720.18
5.5.70.0030.04720.07
5.5.60.0030.05720.15
5.5.50.0030.07320.14
5.5.40.0100.07320.05
5.5.30.0030.08020.15
5.5.20.0100.06020.15
5.5.10.0000.08320.04
5.5.00.0100.05720.09
5.4.450.0030.08019.42
5.4.440.0000.08319.27
5.4.430.0000.08019.48
5.4.420.0030.07719.46
5.4.410.0100.07319.07
5.4.400.0030.08019.03
5.4.390.0030.07319.14
5.4.380.0070.07319.18
5.4.370.0100.06019.14
5.4.360.0070.07019.05
5.4.350.0000.07719.09
5.4.340.0070.07319.05
5.4.320.0070.07319.03
5.4.310.0070.07719.03
5.4.300.0070.07319.04
5.4.290.0030.07019.12
5.4.280.0070.07019.23
5.4.270.0000.06718.95
5.4.260.0100.06018.89
5.4.250.0030.05719.20
5.4.240.0070.05719.15
5.4.230.0070.07019.13
5.4.220.0000.08719.03
5.4.210.0030.09019.20
5.4.200.0070.07319.13
5.4.190.0070.06319.13
5.4.180.0100.07318.86
5.4.170.0000.08719.19
5.4.160.0000.07719.07
5.4.150.0030.08019.12
5.4.140.0070.06016.46
5.4.130.0030.07016.24
5.4.120.0030.07316.43
5.4.110.0100.07316.52
5.4.100.0070.06316.45
5.4.90.0000.07716.48
5.4.80.0070.07016.46
5.4.70.0030.06316.38
5.4.60.0000.04716.27
5.4.50.0000.06016.25
5.4.40.0070.05316.38
5.4.30.0100.06316.48
5.4.20.0030.06716.43
5.4.10.0030.03316.31
5.4.00.0000.04715.85
5.3.290.0030.07014.73
5.3.280.0100.06014.59
5.3.270.0070.06314.74
5.3.260.0030.07714.67
5.3.250.0030.06714.60
5.3.240.0030.06314.64
5.3.230.0070.06314.53
5.3.220.0030.07714.70
5.3.210.0030.07714.70
5.3.200.0070.07314.51
5.3.190.0030.08014.70
5.3.180.0000.07314.51
5.3.170.0000.05714.60
5.3.160.0000.04714.50
5.3.150.0030.04314.68
5.3.140.0070.07714.57
5.3.130.0030.04714.53
5.3.120.0000.07014.62
5.3.110.0000.04014.67
5.3.100.0000.05714.02
5.3.90.0000.05714.03
5.3.80.0070.04314.09
5.3.70.0000.07714.04
5.3.60.0030.03714.02
5.3.50.0030.07013.89
5.3.40.0130.06314.02
5.3.30.0030.07014.06
5.3.20.0030.07713.84
5.3.10.0100.04713.75
5.3.00.0000.05313.70
5.2.170.0030.05712.22
5.2.160.0000.06312.22
5.2.150.0030.06012.22
5.2.140.0030.05312.22
5.2.130.0000.06312.22
5.2.120.0030.06312.22
5.2.110.0070.06012.22
5.2.100.0000.06312.22
5.2.90.0070.05712.22
5.2.80.0070.06012.22
5.2.70.0000.06012.22
5.2.60.0000.06712.22
5.2.50.0030.06712.22
5.2.40.0030.05712.22
5.2.30.0030.05712.22
5.2.20.0070.05312.22
5.2.10.0030.05012.22
5.2.00.0030.05712.22
5.1.60.0000.05012.22
5.1.50.0030.04012.22
5.1.40.0030.05312.22
5.1.30.0070.04712.22
5.1.20.0000.05712.22
5.1.10.0030.05312.22
5.1.00.0030.05312.22
5.0.50.0000.04712.22
5.0.40.0000.02712.22
5.0.30.0070.06012.22
5.0.20.0030.03712.22
5.0.10.0000.04012.22
5.0.00.0000.05712.22
4.4.90.0070.03012.22
4.4.80.0070.01312.22
4.4.70.0070.03312.22
4.4.60.0100.02712.22
4.4.50.0000.03712.22
4.4.40.0000.05312.22
4.4.30.0000.03312.22
4.4.20.0000.02712.22
4.4.10.0000.03712.22
4.4.00.0030.05312.22
4.3.110.0000.03312.22
4.3.100.0070.03012.22
4.3.90.0030.03012.22
4.3.80.0000.03012.22
4.3.70.0000.03712.22
4.3.60.0030.03012.22
4.3.50.0000.03312.22
4.3.40.0000.05312.22
4.3.30.0000.03712.22
4.3.20.0000.04012.22
4.3.10.0000.03012.22
4.3.00.0030.03712.22

preferences:
40.26 ms | 401 KiB | 5 Q