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); } } runTests('checkWithPreg'); echo "\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.0130.00317.00
8.3.50.0100.00718.29
8.3.40.0090.00618.88
8.3.30.0110.00418.91
8.3.20.0050.00319.08
8.3.10.0060.00320.61
8.3.00.0060.00317.75
8.2.180.0110.00418.64
8.2.170.0170.00322.96
8.2.160.0030.01020.52
8.2.150.0000.00724.18
8.2.140.0030.00624.66
8.2.130.0140.00026.16
8.2.120.0030.00520.20
8.2.110.0070.00421.06
8.2.100.0000.01318.16
8.2.90.0070.00319.39
8.2.80.0090.00018.03
8.2.70.0080.00017.63
8.2.60.0040.00418.04
8.2.50.0050.00518.07
8.2.40.0050.00318.22
8.2.30.0040.00418.30
8.2.20.0060.00317.84
8.2.10.0050.00217.98
8.2.00.0040.00417.87
8.1.280.0110.00425.92
8.1.270.0030.00724.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0100.00022.34
8.1.230.0080.00321.04
8.1.220.0040.00417.74
8.1.210.0040.00418.91
8.1.200.0060.00317.48
8.1.190.0000.00817.40
8.1.180.0050.00318.10
8.1.170.0050.00318.84
8.1.160.0080.00019.00
8.1.150.0030.00518.81
8.1.140.0000.00817.79
8.1.130.0040.00417.74
8.1.120.0000.00717.63
8.1.110.0040.00417.59
8.1.100.0080.00017.70
8.1.90.0030.00617.60
8.1.80.0040.00417.73
8.1.70.0040.00417.64
8.1.60.0030.00717.64
8.1.50.0000.00817.77
8.1.40.0040.00417.80
8.1.30.0000.00817.77
8.1.20.0090.00017.91
8.1.10.0030.00517.71
8.1.00.0040.00417.71
8.0.300.0040.00419.88
8.0.290.0040.00417.00
8.0.280.0000.00718.42
8.0.270.0030.00317.42
8.0.260.0000.00617.04
8.0.250.0080.00017.29
8.0.240.0030.00617.13
8.0.230.0000.00717.20
8.0.220.0000.00817.18
8.0.210.0040.00417.12
8.0.200.0000.00717.21
8.0.190.0040.00417.25
8.0.180.0040.00417.14
8.0.170.0030.00617.20
8.0.160.0000.00817.14
8.0.150.0040.00417.20
8.0.140.0030.00617.15
8.0.130.0000.00613.70
8.0.120.0080.00017.04
8.0.110.0050.00317.21
8.0.100.0040.00417.21
8.0.90.0000.00717.22
8.0.80.0130.00317.14
8.0.70.0020.00517.22
8.0.60.0030.00617.20
8.0.50.0080.00017.20
8.0.30.0090.01017.40
8.0.20.0130.00817.18
8.0.10.0000.00716.96
8.0.00.0150.00517.07
7.4.330.0050.00013.27
7.4.320.0030.00316.79
7.4.300.0000.00616.75
7.4.290.0040.00416.81
7.4.280.0060.00316.73
7.4.270.0090.00016.75
7.4.260.0000.00613.56
7.4.250.0030.00616.77
7.4.240.0030.00316.85
7.4.230.0070.00016.64
7.4.220.0160.00316.80
7.4.210.0080.00716.87
7.4.200.0030.00316.93
7.4.190.0040.00417.03
7.4.160.0120.00516.75
7.4.150.0130.00716.93
7.4.140.0120.00717.00
7.4.130.0080.00916.62
7.4.120.0100.00916.79
7.4.110.0030.01616.70
7.4.100.0070.01016.62
7.4.90.0140.01016.79
7.4.80.0120.00816.92
7.4.70.0110.00616.57
7.4.60.0110.00616.68
7.4.50.0060.00016.71
7.4.40.0070.01016.88
7.4.30.0030.01316.77
7.4.00.0070.01015.23
7.3.330.0030.00313.43
7.3.320.0030.00313.43
7.3.310.0000.00816.71
7.3.300.0000.00716.52
7.3.290.0090.00616.72
7.3.280.0100.00616.62
7.3.270.0090.00916.50
7.3.260.0130.01016.73
7.3.250.0100.00716.66
7.3.240.0070.01016.87
7.3.230.0100.01316.59
7.3.210.0090.00916.90
7.3.200.0000.01819.39
7.3.190.0080.00916.84
7.3.180.0030.01316.83
7.3.170.0070.01116.45
7.3.160.0070.01016.72
7.3.120.0120.00314.75
7.2.330.0090.00916.68
7.2.320.0090.01216.82
7.2.310.0090.01516.80
7.2.300.0060.01216.87
7.2.290.0060.01116.86
7.2.60.0080.00616.98
7.1.200.0000.01215.96
7.1.70.0000.01017.30
7.1.60.0070.01819.40
7.1.50.0060.00917.26
7.1.00.0030.07022.38
7.0.200.0040.00815.11
7.0.140.0030.07322.18
7.0.120.0100.06322.19
7.0.60.0030.07319.92
7.0.50.0130.03317.96
7.0.40.0130.08020.42
7.0.30.0400.06720.14
7.0.20.0300.08020.08
7.0.10.0100.07320.18
7.0.00.0100.07020.13
5.6.280.0030.07321.00
5.6.210.0030.04320.52
5.6.200.0030.08718.25
5.6.190.0000.09020.45
5.6.180.0300.06320.50
5.6.170.0370.05720.39
5.6.160.0100.08320.47
5.6.150.0000.05318.24
5.6.140.0230.06318.15
5.6.130.0030.05718.17
5.6.120.0100.04321.06
5.6.110.0170.07021.04
5.6.100.0070.08720.99
5.6.90.0100.08721.05
5.6.80.0100.07320.39
5.5.350.0230.08020.29
5.5.340.0070.05718.09
5.5.330.0130.03720.32
5.5.320.0230.06020.36
5.5.310.0330.06720.52
5.5.300.0100.06018.08
5.5.290.0200.07018.08
5.5.280.0130.08020.89
5.5.270.0100.04720.84
5.5.260.0100.06320.89
5.5.250.0000.04320.71
5.5.240.0100.07020.25
5.4.450.3670.04319.25
5.4.440.5730.03319.39
5.4.430.3770.03319.55
5.4.420.3670.04019.45
5.4.410.2670.03319.44
5.4.400.3130.03719.16
5.4.390.3570.04019.08
5.4.380.1300.04719.04
5.4.370.4370.04019.10
5.4.360.5530.04319.04
5.4.350.3930.03719.10
5.4.340.4270.04019.06
5.4.320.4700.03318.93
5.4.310.4570.04019.19
5.4.300.4700.03319.04
5.4.290.4270.04019.15
5.4.280.3770.03719.16
5.4.270.4900.04018.93
5.4.260.4700.03319.04
5.4.250.4600.04319.21
5.4.240.4570.03719.21
5.4.230.3900.04018.94
5.4.220.4070.03319.15
5.4.210.4070.02719.12
5.4.200.4170.03719.21
5.4.190.3900.04019.12
5.4.180.4030.03718.92
5.4.170.3930.03319.23
5.4.160.4330.04019.13
5.4.150.3670.04018.98
5.4.140.4330.04316.59
5.4.130.4130.03316.55
5.4.120.3500.03316.48
5.4.110.4300.03716.54
5.4.100.4170.03016.53
5.4.90.3570.03716.68
5.4.80.4170.03016.66
5.4.70.3800.03716.67
5.4.60.4470.03016.53
5.4.50.4370.04716.45
5.4.40.4600.03016.22
5.4.30.3930.03316.53
5.4.20.3930.03316.53
5.4.10.3900.04016.20
5.4.00.4170.03315.80
5.3.290.4700.04014.69
5.3.280.4030.04314.61
5.3.270.4130.04714.63
5.3.260.3730.04314.78
5.3.250.3900.03314.77
5.3.240.3770.04014.54
5.3.230.4230.03314.68
5.3.220.3800.03314.64
5.3.210.3900.03714.59
5.3.200.3930.04014.63
5.3.190.4000.04014.63
5.3.180.3770.02314.63
5.3.170.3970.03714.59
5.3.160.4370.03714.72
5.3.150.3530.04714.61
5.3.140.4130.03714.58
5.3.130.4200.03014.56
5.3.120.4000.04714.57
5.3.110.3500.03714.56
5.3.100.3730.04314.04
5.3.90.4370.03314.07
5.3.80.4630.03314.07
5.3.70.4770.03314.20
5.3.60.4500.03013.98
5.3.50.3800.03013.99
5.3.40.3770.04013.88
5.3.30.4070.04013.96
5.3.20.3900.03313.75
5.3.10.4630.03013.63
5.3.00.2930.03713.72
5.2.170.3070.03311.31
5.2.160.3230.02711.31
5.2.150.3000.02711.34
5.2.140.3470.02311.16
5.2.130.3300.03311.04
5.2.120.4030.02311.27
5.2.110.3470.02311.18
5.2.100.3100.03011.27
5.2.90.3030.03011.16
5.2.80.3000.03311.05
5.2.70.2700.03311.11
5.2.60.3070.02711.01
5.2.50.3000.03010.95
5.2.40.2470.03011.16
5.2.30.2430.02711.06
5.2.20.2470.03011.03
5.2.10.2630.02710.86
5.2.00.2430.03010.66
5.1.60.2430.02310.16
5.1.50.2470.02010.02
5.1.40.2400.02710.07
5.1.30.2930.02710.36
5.1.20.2570.01710.37
5.1.10.2170.02310.24
5.1.00.0000.02710.06
5.0.50.0030.0308.54
5.0.40.0030.0478.40
5.0.30.0000.0678.39
5.0.20.0070.0438.27
5.0.10.1900.0308.24
5.0.00.1530.0338.18
4.4.90.1300.0136.14
4.4.80.1230.0136.17
4.4.70.1270.0136.20
4.4.60.1200.0176.20
4.4.50.1370.0206.20
4.4.40.1200.0276.20
4.4.30.1270.0106.20
4.4.20.1570.0206.20
4.4.10.0030.0376.20
4.4.00.0030.0406.20
4.3.110.0000.0276.20
4.3.100.0000.0376.20
4.3.90.1870.0106.20
4.3.80.1430.0236.20
4.3.70.1000.0136.20
4.3.60.1470.0136.20
4.3.50.1400.0176.20
4.3.40.1570.0276.20
4.3.30.0900.0206.20
4.3.20.0970.0206.20
4.3.10.0930.0236.20
4.3.00.0930.0206.20

preferences:
32.75 ms | 401 KiB | 5 Q