3v4l.org

run code in 300+ PHP versions simultaneously
<?php if ( !function_exists( 'mb_convert_encoding' ) ) { exit('[mbstring not loaded]'); } $oldSub = mb_substitute_character(); mb_substitute_character( 0xfffd ); $res = mb_convert_encoding( "\xf4\x90\x80\x80 \xc2", 'UTF-8', 'UTF-8' ); mb_substitute_character( $oldSub ); if ( $res === "\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd" ) { // mbstring follows best practices. $level = 3; } elseif ( $res[0] !== "\xef" ) { // mbstring is old; it treats values above U+10FFFF as valid. // This is the case for PHP 5.3. $level = 0; } elseif ( substr_compare( $res, " \xef\xbf\xbd", -4 ) !== 0 ) { // mbstring is affected by <https://bugs.php.net/bug.php?id=65045>. $level = 1; } else { // mbstring nevertheless doesn't follow best practices. (Perhaps this system // has an old version of ICU, and mbstring was changed to use it.) $level = 2; } echo $level;

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.0100.01018.43
8.3.50.0120.00822.05
8.3.40.0000.01518.59
8.3.30.0130.00020.17
8.3.20.0000.00720.34
8.3.10.0060.00322.09
8.3.00.0080.00022.29
8.2.180.0170.00318.16
8.2.170.0070.01422.96
8.2.160.0070.00720.35
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0060.00326.16
8.2.120.0050.00319.54
8.2.110.0040.00721.96
8.2.100.0110.00019.12
8.2.90.0040.00419.22
8.2.80.0070.00019.16
8.2.70.0070.00317.63
8.2.60.0060.00317.80
8.2.50.0030.00618.07
8.2.40.0090.00018.01
8.2.30.0000.00717.96
8.2.20.0040.00417.69
8.2.10.0040.00417.77
8.2.00.0070.00317.75
8.1.280.0060.00925.92
8.1.270.0000.00824.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00023.82
8.1.230.0040.00818.91
8.1.220.0030.00617.74
8.1.210.0000.00818.77
8.1.200.0000.01017.23
8.1.190.0000.00717.53
8.1.180.0040.00419.14
8.1.170.0000.00818.58
8.1.160.0000.00722.15
8.1.150.0030.00618.82
8.1.140.0040.00417.46
8.1.130.0030.00317.86
8.1.120.0000.00817.52
8.1.110.0060.00317.55
8.1.100.0000.00717.45
8.1.90.0000.00817.45
8.1.80.0040.00417.46
8.1.70.0030.00317.51
8.1.60.0030.00617.55
8.1.50.0050.00317.61
8.1.40.0030.00517.68
8.1.30.0000.00717.77
8.1.20.0030.00617.67
8.1.10.0070.00017.64
8.1.00.0000.00817.45
8.0.300.0000.00718.77
8.0.290.0080.00017.30
8.0.280.0030.00318.53
8.0.270.0000.00717.26
8.0.260.0000.00817.02
8.0.250.0000.00717.09
8.0.240.0060.00317.11
8.0.230.0000.00717.02
8.0.220.0040.00416.85
8.0.210.0030.00317.02
8.0.200.0000.00617.01
8.0.190.0040.00417.02
8.0.180.0040.00417.05
8.0.170.0000.00816.92
8.0.160.0080.00016.95
8.0.150.0000.00716.81
8.0.140.0040.00416.91
8.0.130.0030.00313.40
8.0.120.0020.00516.87
8.0.110.0040.00416.90
8.0.100.0070.00016.98
8.0.90.0040.00416.85
8.0.80.0060.00916.98
8.0.70.0020.00516.86
8.0.60.0040.00416.87
8.0.50.0070.00017.09
8.0.30.0100.01117.21
8.0.20.0090.01317.41
8.0.10.0000.00716.82
8.0.00.0120.00716.87
7.4.330.0030.00315.14
7.4.320.0000.00716.60
7.4.300.0000.00616.62
7.4.290.0030.00316.68
7.4.280.0000.00716.70
7.4.270.0000.00716.59
7.4.260.0030.00616.58
7.4.250.0000.00716.67
7.4.240.0050.00316.55
7.4.230.0000.00716.62
7.4.220.0060.01616.52
7.4.210.0100.00916.65
7.4.200.0000.00716.80
7.4.190.0030.00316.55
7.4.160.0060.00916.52
7.4.150.0110.00617.40
7.4.140.0060.01217.86
7.4.130.0090.00816.61
7.4.120.0160.00216.41
7.4.110.0140.00816.72
7.4.100.0120.00616.48
7.4.90.0060.01316.48
7.4.80.0070.01019.39
7.4.70.0170.00316.49
7.4.60.0150.01816.21
7.4.50.0030.00616.53
7.4.40.0080.00822.77
7.4.30.0050.01416.54
7.4.00.0000.01114.82
7.3.330.0030.00213.22
7.3.320.0050.00013.15
7.3.310.0050.00216.48
7.3.300.0000.00716.33
7.3.290.0090.00916.30
7.3.280.0070.00816.36
7.3.270.0130.00717.40
7.3.260.0130.00916.53
7.3.250.0130.00616.29
7.3.240.0140.01016.28
7.3.230.0060.01516.39
7.3.210.0130.00316.26
7.3.200.0110.00619.39
7.3.190.0030.01916.41
7.3.180.0000.01616.32
7.3.170.0100.01016.45
7.3.160.0040.01216.37
7.3.120.0070.00714.73
7.2.330.0110.00716.64
7.2.320.0140.00316.58
7.2.310.0150.00316.55
7.2.300.0130.00316.44
7.2.290.0080.00816.57
7.1.70.0110.00717.19
7.1.60.0080.01619.43
7.1.50.0090.01217.02
7.1.00.0000.03722.58
7.0.200.0060.00616.61
7.0.140.0000.07022.00
7.0.70.3300.03719.92
7.0.60.0000.06319.88
7.0.50.0100.07317.90
7.0.40.0200.07720.29
7.0.30.0230.07020.04
7.0.20.0370.05720.30
7.0.10.0230.05320.10
7.0.00.0130.05020.12
5.6.280.0070.07021.06
5.6.210.0100.08020.71
5.6.200.0070.06718.21
5.6.190.0030.04320.45
5.6.180.0170.03720.65
5.6.170.0270.04720.48
5.6.160.0030.09020.50
5.6.150.0130.07318.15
5.6.140.0100.07718.18
5.6.130.0030.06018.21
5.6.120.0100.04321.00
5.6.110.0100.06320.98
5.6.100.0030.08720.98
5.6.90.0070.08321.12
5.6.80.0070.08320.35
5.6.70.0070.07720.49
5.5.350.0000.06720.40
5.5.340.0070.03717.92
5.5.330.0000.04320.29
5.5.320.0000.07320.15
5.5.310.0270.04020.29
5.5.300.0070.04317.97
5.5.290.0230.03017.92
5.5.280.0100.05020.80
5.5.270.0130.08020.84
5.5.260.0170.05020.75
5.5.250.0130.05720.65
5.5.240.0130.07020.15
5.4.450.0200.05719.29
5.4.440.0730.07719.13
5.4.430.0830.06319.51
5.4.420.0770.05719.63
5.4.410.0600.06019.34
5.4.400.0670.05718.81
5.4.390.0830.05719.25
5.4.380.0130.05718.59
5.4.370.0170.04318.65
5.4.360.0230.04318.44
5.4.350.0080.06511.97
5.4.340.0150.07311.97
5.4.320.0100.04912.46
5.4.310.0070.04012.45
5.4.300.0060.03612.46
5.4.290.0050.03812.45
5.4.280.0070.03412.35
5.4.270.0030.05112.35
5.4.260.0080.03612.35
5.4.250.0070.05318.82
5.4.240.0130.07018.77
5.4.230.0070.05019.02
5.4.220.0030.06018.72
5.4.210.0130.06018.82
5.4.200.0170.05018.82
5.4.190.0070.05718.90
5.4.180.0130.06318.73
5.4.170.0070.06718.72
5.4.160.0100.05018.71
5.4.150.0200.04318.69
5.4.140.0130.04316.55
5.4.130.0170.05316.39
5.4.120.0130.04316.25
5.4.110.0200.03716.34
5.4.100.0100.04316.26
5.4.90.0070.06016.45
5.4.80.0030.05016.28
5.4.70.0070.04716.53
5.4.60.0230.03316.36
5.4.50.0030.05016.23
5.4.40.0000.05716.32
5.4.30.0030.05316.33
5.4.20.0170.06316.46
5.4.10.0070.05016.32
5.4.00.0070.04715.94
5.3.290.0090.03712.80
5.3.280.0130.04314.48
5.3.270.0070.05714.49
5.3.260.0030.08014.38
5.3.250.0100.04714.44
5.3.240.0000.05714.39
5.3.230.0130.04714.43
5.3.220.0030.05014.45
5.3.210.0070.05314.58
5.3.200.0030.05314.45
5.3.190.0070.05314.42
5.3.180.0030.07014.56
5.3.170.0070.05014.41
5.3.160.0170.04714.48
5.3.150.0130.04314.57
5.3.140.0030.05314.25
5.3.130.0030.05714.57
5.3.120.0200.04014.43
5.3.110.0030.05314.45
5.3.100.0000.05713.81
5.3.90.0070.04713.79
5.3.80.0030.05313.93
5.3.70.0030.05013.95
5.3.60.0030.05314.14
5.3.50.0130.04013.86
5.3.40.0100.06013.87
5.3.30.0100.04713.90
5.3.20.0070.06713.53
5.3.10.0070.06013.50
5.3.00.0070.05013.51
5.2.170.0000.04711.16
5.2.160.0030.04311.26
5.2.150.0030.05711.29
5.2.140.0070.05310.99
5.2.130.0100.05310.93
5.2.120.0170.03011.00
5.2.110.0170.04710.99
5.2.100.0030.04010.86
5.2.90.0070.03711.01
5.2.80.0070.03710.85
5.2.70.0070.04011.09
5.2.60.0070.04711.14
5.2.50.0100.05010.80
5.2.40.0070.04711.00
5.2.30.0070.04710.80
5.2.20.0100.03311.05
5.2.10.0100.03710.82
5.2.00.0030.05710.71
5.1.60.0030.0509.98
5.1.50.0030.0339.82
5.1.40.0100.04310.07
5.1.30.0070.03310.28
5.1.20.0070.03310.59
5.1.10.0030.03710.25
5.1.00.0070.03310.13
5.0.50.0000.0308.63
5.0.40.0100.0208.36
5.0.30.0070.0438.25
5.0.20.0030.0278.28
5.0.10.0030.0378.20
5.0.00.0000.0608.22
4.4.90.0070.0236.50
4.4.80.0070.0176.50
4.4.70.0030.0206.50
4.4.60.0030.0236.50
4.4.50.0030.0206.50
4.4.40.0030.0306.50
4.4.30.0030.0206.50
4.4.20.0000.0236.50
4.4.10.0030.0206.50
4.4.00.0100.0276.50
4.3.110.0030.0236.50
4.3.100.0070.0236.50
4.3.90.0100.0206.50
4.3.80.0000.0376.50
4.3.70.0030.0206.50
4.3.60.0000.0236.50
4.3.50.0100.0306.50
4.3.40.0030.0336.50
4.3.30.0100.0136.50
4.3.20.0030.0206.50
4.3.10.0030.0276.50
4.3.00.0000.0307.26

preferences:
52.14 ms | 400 KiB | 5 Q