3v4l.org

run code in 300+ PHP versions simultaneously
<?php function stripNonValidCharaters ($message) { $validGSMKeycodes = [ 0x0040, 0x0394, 0x0020, 0x0030, 0x00a1, 0x0050, 0x00bf, 0x0070, 0x00a3, 0x005f, 0x0021, 0x0031, 0x0041, 0x0051, 0x0061, 0x0071, 0x0024, 0x03a6, 0x0022, 0x0032, 0x0042, 0x0052, 0x0062, 0x0072, 0x00a5, 0x0393, 0x0023, 0x0033, 0x0043, 0x0053, 0x0063, 0x0073, 0x00e8, 0x039b, 0x00a4, 0x0034, 0x0035, 0x0044, 0x0054, 0x0064, 0x0074, 0x00e9, 0x03a9, 0x0025, 0x0045, 0x0045, 0x0055, 0x0065, 0x0075, 0x00f9, 0x03a0, 0x0026, 0x0036, 0x0046, 0x0056, 0x0066, 0x0076, 0x00ec, 0x03a8, 0x0027, 0x0037, 0x0047, 0x0057, 0x0067, 0x0077, 0x00f2, 0x03a3, 0x0028, 0x0038, 0x0048, 0x0058, 0x0068, 0x0078, 0x00c7, 0x0398, 0x0029, 0x0039, 0x0049, 0x0059, 0x0069, 0x0079, 0x000a, 0x039e, 0x002a, 0x003a, 0x004a, 0x005a, 0x006a, 0x007a, 0x00d8, 0x001b, 0x002b, 0x003b, 0x004b, 0x00c4, 0x006b, 0x00e4, 0x00f8, 0x00c6, 0x002c, 0x003c, 0x004c, 0x00d6, 0x006c, 0x00f6, 0x000d, 0x00e6, 0x002d, 0x003d, 0x004d, 0x00d1, 0x006d, 0x00f1, 0x00c5, 0x00df, 0x002e, 0x003e, 0x004e, 0x00dc, 0x006e, 0x00fc, 0x00e5, 0x00c9, 0x002f, 0x003f, 0x004f, 0x00a7, 0x006f, 0x00e0 ]; $count = 0; for($i = 0; $i < strlen($message); $i++) { if(!in_array(ord($message[$i]), $validGSMKeycodes, true) || ord($message[$i]) == 0) { $message[$i] = ''; $count++; } } return ['message' => $message, 'replacements' => $count]; } $msg = "pусский алфавит"; $tmp['message'] = ''; while ($tmp['message'] != $msg) { $tmp = stripNonValidCharaters($msg); $msg = $tmp['message']; } var_dump($msg); for($i = 0; $i < strlen($msg); $i++) { var_dump(ord($msg[$i])); }

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.0090.00918.68
8.3.50.0130.00521.95
8.3.40.0060.00919.02
8.3.30.0000.01419.21
8.3.20.0070.00020.20
8.3.10.0040.00423.65
8.3.00.0060.00319.50
8.2.180.0110.01116.88
8.2.170.0100.00722.96
8.2.160.0030.01020.39
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0000.00726.16
8.2.120.0050.00322.29
8.2.110.0100.00022.16
8.2.100.0060.00617.75
8.2.90.0040.00419.17
8.2.80.0050.00317.97
8.2.70.0080.00417.25
8.2.60.0040.00417.93
8.2.50.0030.00518.07
8.2.40.0050.00319.88
8.2.30.0000.00718.00
8.2.20.0050.00317.88
8.2.10.0040.00418.19
8.2.00.0030.00617.84
8.1.280.0130.00325.92
8.1.270.0000.00823.87
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0060.00323.80
8.1.230.0100.00319.26
8.1.220.0000.00817.78
8.1.210.0060.00318.77
8.1.200.0070.00317.22
8.1.190.0040.00417.22
8.1.180.0030.00518.10
8.1.170.0050.00318.71
8.1.160.0000.00821.98
8.1.150.0000.00718.90
8.1.140.0070.00017.51
8.1.130.0030.00317.82
8.1.120.0000.00717.49
8.1.110.0020.00517.47
8.1.100.0030.00317.38
8.1.90.0040.00417.47
8.1.80.0070.00017.35
8.1.70.0000.00717.40
8.1.60.0080.00017.58
8.1.50.0040.00417.41
8.1.40.0040.00417.38
8.1.30.0000.00817.67
8.1.20.0040.00417.63
8.1.10.0040.00417.62
8.1.00.0040.00417.54
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0030.00318.38
8.0.270.0070.00017.18
8.0.260.0000.00717.18
8.0.250.0000.00716.98
8.0.240.0030.00317.04
8.0.230.0050.00317.10
8.0.220.0040.00417.00
8.0.210.0000.00716.97
8.0.200.0050.00316.99
8.0.190.0040.00416.98
8.0.180.0000.00717.00
8.0.170.0030.00516.87
8.0.160.0000.00716.97
8.0.150.0000.00716.83
8.0.140.0040.00416.93
8.0.130.0000.00513.46
8.0.120.0050.00316.93
8.0.110.0000.00716.85
8.0.100.0020.00516.85
8.0.90.0050.00316.85
8.0.80.0030.01216.94
8.0.70.0040.00416.79
8.0.60.0020.00517.02
8.0.50.0000.00816.84
8.0.30.0090.00917.21
8.0.20.0080.01117.40
8.0.10.0000.00717.00
8.0.00.0100.00816.94
7.4.330.0060.00015.00
7.4.320.0060.00016.52
7.4.300.0040.00416.50
7.4.290.0040.00416.51
7.4.280.0000.00816.61
7.4.270.0050.00316.63
7.4.260.0080.00016.57
7.4.250.0050.00316.48
7.4.240.0020.00616.51
7.4.230.0080.00016.53
7.4.220.0090.00916.56
7.4.210.0060.01516.52
7.4.200.0000.00716.64
7.4.160.0100.00716.66
7.4.150.0090.00917.40
7.4.140.0090.00917.86
7.4.130.0110.00816.69
7.4.120.0110.00616.59
7.4.110.0060.01116.57
7.4.100.0090.00816.59
7.4.90.0090.00916.61
7.4.80.0140.00419.39
7.4.70.0060.01216.36
7.4.60.0130.00616.62
7.4.50.0030.00616.32
7.4.40.0140.00716.63
7.4.30.0120.00316.41
7.4.00.0030.01314.88
7.3.330.0000.00613.40
7.3.320.0050.00013.42
7.3.310.0070.00016.32
7.3.300.0030.00316.45
7.3.290.0170.00316.54
7.3.280.0100.00716.41
7.3.270.0160.00417.40
7.3.260.0070.01116.51
7.3.240.0090.00916.37
7.3.230.0090.00916.39
7.3.210.0070.01616.53
7.3.200.0060.01319.39
7.3.190.0150.00916.49
7.3.180.0170.00316.55
7.3.170.0100.00616.38
7.3.160.0060.01016.43
7.3.120.0130.00314.84
7.3.110.0000.01014.92
7.3.100.0040.00814.96
7.3.90.0070.00714.83
7.3.80.0070.00715.02
7.3.70.0000.01314.91
7.3.60.0030.01014.91
7.3.50.0030.00914.97
7.3.40.0030.01014.86
7.3.30.0070.00414.73
7.3.20.0040.01416.74
7.3.10.0060.00616.62
7.3.00.0100.00516.70
7.2.330.0100.01416.77
7.2.320.0090.00916.85
7.2.310.0110.00816.49
7.2.300.0060.01016.82
7.2.290.0110.01116.65
7.2.240.0000.01314.98
7.2.230.0090.00314.89
7.2.220.0100.00714.95
7.2.210.0060.01015.22
7.2.200.0070.00715.26
7.2.190.0030.00714.85
7.2.180.0070.01015.15
7.2.170.0040.01115.06
7.2.160.0090.00615.16
7.2.150.0040.01116.77
7.2.140.0070.01016.71
7.2.130.0070.00717.03
7.2.120.0070.00716.88
7.2.110.0030.01117.08
7.2.100.0080.00816.81
7.2.90.0070.00816.86
7.2.80.0110.00616.97
7.2.70.0050.00716.77
7.2.60.0040.00917.02
7.2.50.0040.00916.70
7.2.40.0050.00816.98
7.2.30.0060.00916.96
7.2.20.0070.00916.86
7.2.10.0050.00916.99
7.2.00.0060.00817.46
7.1.330.0030.01015.60
7.1.320.0070.00415.54
7.1.310.0000.01315.63
7.1.300.0040.01415.71
7.1.290.0030.01415.69
7.1.280.0040.01115.76
7.1.270.0030.00915.57
7.1.260.0090.00915.54
7.1.250.0060.00615.78
7.1.200.0060.00615.52
7.1.100.0000.00918.29
7.1.70.0000.00817.30
7.1.60.0130.01019.32
7.1.50.0090.01516.85
7.1.00.0030.07722.37
7.0.200.0710.00714.73
7.0.140.0070.07021.95
7.0.60.0030.04019.83
7.0.50.0100.07717.91
7.0.40.0070.04020.05
7.0.30.0600.06320.15
7.0.20.0230.08320.06
7.0.10.0000.04720.25
7.0.00.0100.05020.29
5.6.280.0000.07721.10
5.6.210.0170.07320.64
5.6.200.0000.04718.18
5.6.190.0030.09020.41
5.6.180.0130.04720.64
5.6.170.0300.06320.62
5.6.160.0000.06720.54
5.6.150.0130.04718.15
5.6.140.0130.06318.16
5.6.130.0030.08018.23
5.6.120.0070.05320.94
5.6.110.0100.08721.13
5.6.100.0100.08321.02
5.6.90.0030.06020.99
5.6.80.0070.03720.50
5.5.350.0130.03320.32
5.5.340.0100.07318.00
5.5.330.0100.07320.40
5.5.320.0300.06320.19
5.5.310.0270.07720.36
5.5.300.0030.08717.99
5.5.290.0030.08317.95
5.5.280.0070.07020.75
5.5.270.0030.04320.66
5.5.260.0070.08320.89
5.5.250.0130.07320.50
5.5.240.0200.07020.25
5.4.450.0170.05719.48
5.4.440.0070.06719.58
5.4.430.0170.06019.62
5.4.420.0670.00019.21
5.4.410.0670.00019.40
5.4.400.0630.00019.34
5.4.390.0630.00019.13
5.4.380.0630.00019.15
5.4.370.0630.00019.05
5.4.360.0630.00019.13
5.4.350.0670.00019.13
5.4.340.0110.03712.04
5.4.320.0040.03912.53
5.4.310.0040.04012.52
5.4.300.0070.03612.53
5.4.290.0070.04112.52
5.4.280.0050.04412.42
5.4.270.0100.04712.42
5.4.260.0120.03512.42
5.4.250.0050.03812.43
5.4.240.0060.03612.42
5.4.230.0060.03912.41
5.4.220.0110.03012.41
5.4.210.0040.03712.41
5.4.200.0110.04212.42
5.4.190.0070.03612.41
5.4.180.0070.04212.41
5.4.170.0070.03512.42
5.4.160.0070.03512.41
5.4.150.0040.03812.41
5.4.140.0030.04012.09
5.4.130.0040.03612.08
5.4.120.0070.03412.04
5.4.110.0070.03512.04
5.4.100.0040.03812.04
5.4.90.0050.04012.04
5.4.80.0100.04012.03
5.4.70.0040.04212.04
5.4.60.0060.03412.03
5.4.50.0070.03612.03
5.4.40.0080.03412.02
5.4.30.0070.03612.02
5.4.20.0040.03812.02
5.4.10.0090.03312.02
5.4.00.0050.03811.51
5.3.290.0090.04212.80
5.3.280.0050.04012.71
5.3.270.0020.04412.72
5.3.260.0050.04012.71
5.3.250.0070.03612.72
5.3.240.0070.03612.72
5.3.230.0080.03612.71
5.3.220.0050.03912.68
5.3.210.0070.04212.68
5.3.200.0050.04112.68
5.3.190.0060.03912.68
5.3.180.0040.03812.67
5.3.170.0050.03912.67
5.3.160.0090.03812.68
5.3.150.0110.03712.67
5.3.140.0070.03712.66
5.3.130.0060.04412.66
5.3.120.0100.04112.66
5.3.110.0070.04012.66
5.3.100.0070.03712.13
5.3.90.0060.04412.12
5.3.80.0110.03212.09
5.3.70.0100.03512.09
5.3.60.0070.03612.08
5.3.50.0040.04112.02
5.3.40.0050.03812.02
5.3.30.0060.03511.98
5.3.20.0070.03511.76
5.3.10.0100.03211.74
5.3.00.0070.03911.71
5.2.170.0060.0389.22
5.2.160.0060.0429.22
5.2.150.0080.0399.22
5.2.140.0070.0309.22
5.2.130.0100.0289.18
5.2.120.0070.0329.18
5.2.110.0100.0279.18
5.2.100.0070.0319.18
5.2.90.0060.0329.18
5.2.80.0030.0329.18
5.2.70.0060.0289.17
5.2.60.0070.0279.13
5.2.50.0070.0289.09
5.2.40.0040.0329.07
5.2.30.0040.0309.05
5.2.20.0030.0339.05
5.2.10.0100.0268.95
5.2.00.0020.0318.81
5.1.60.0040.0238.09
5.1.50.0060.0228.09
5.1.40.0070.0218.07
5.1.30.0050.0288.42
5.1.20.0050.0258.43
5.1.10.0040.0258.16
5.1.00.0060.0258.16
5.0.50.0030.0206.64
5.0.40.0040.0206.50
5.0.30.0020.0376.31
5.0.20.0030.0196.28
5.0.10.0030.0216.27
5.0.00.0020.0346.25
4.4.90.0030.0164.78
4.4.80.0030.0174.75
4.4.70.0020.0184.76
4.4.60.0020.0174.75
4.4.50.0020.0204.77
4.4.40.0010.0274.71
4.4.30.0030.0154.76
4.4.20.0050.0134.84
4.4.10.0030.0184.85
4.4.00.0010.0264.76
4.3.110.0010.0174.67
4.3.100.0040.0134.66
4.3.90.0030.0194.63
4.3.80.0030.0264.59
4.3.70.0020.0154.63
4.3.60.0080.0104.63
4.3.50.0050.0164.63
4.3.40.0040.0314.54
4.3.30.0030.0183.30
4.3.20.0020.0163.28
4.3.10.0010.0233.24
4.3.00.0070.0178.11

preferences:
39.6 ms | 401 KiB | 5 Q