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(hexdec(bin2hex(mb_substr($message, $i, 1))), $validGSMKeycodes, true)) { $message[$i] = ''; $count++; } } return ['message' => $message, 'replacements' => $count]; } $msg = "pусский алфавит"; $tmp['message'] = ''; while ($tmp['message'] != $msg) { $tmp = stripNonValidCharaters($msg); $msg = $tmp['message']; } var_dump(trim($msg));

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.40.0180.00418.83
8.3.30.0040.01119.21
8.3.20.0050.00320.21
8.3.10.0040.00421.73
8.3.00.0070.00317.63
8.2.170.0140.00022.96
8.2.160.0030.01020.35
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00422.06
8.2.110.0000.00921.07
8.2.100.0090.00317.75
8.2.90.0040.00419.36
8.2.80.0000.00817.97
8.2.70.0060.00317.63
8.2.60.0050.00318.03
8.2.50.0040.00418.07
8.2.40.0050.00318.16
8.2.30.0040.00418.06
8.2.20.0060.00317.82
8.2.10.0020.00518.26
8.2.00.0030.00617.84
8.1.270.0090.00623.96
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0060.00323.97
8.1.230.0090.00317.48
8.1.220.0060.00317.74
8.1.210.0050.00518.77
8.1.200.0040.00417.36
8.1.190.0000.00817.13
8.1.180.0000.00718.10
8.1.170.0040.00418.59
8.1.160.0070.00021.98
8.1.150.0080.00018.77
8.1.140.0000.00717.48
8.1.130.0030.00317.86
8.1.120.0030.00517.39
8.1.110.0000.00817.50
8.1.100.0000.00717.50
8.1.90.0000.00817.39
8.1.80.0000.00717.38
8.1.70.0030.00317.46
8.1.60.0040.00417.52
8.1.50.0040.00417.45
8.1.40.0000.00917.64
8.1.30.0000.00817.68
8.1.20.0030.00517.65
8.1.10.0050.00317.55
8.1.00.0080.00017.61
8.0.300.0060.00318.77
8.0.290.0040.00416.75
8.0.280.0030.00318.45
8.0.270.0070.00017.26
8.0.260.0000.00817.34
8.0.250.0030.00317.16
8.0.240.0070.00017.11
8.0.230.0000.00717.05
8.0.220.0030.00517.06
8.0.210.0000.00817.09
8.0.200.0000.00817.13
8.0.190.0030.00617.01
8.0.180.0070.00017.06
8.0.170.0030.00616.97
8.0.160.0040.00417.05
8.0.150.0070.00017.00
8.0.140.0000.00717.04
8.0.130.0040.00313.51
8.0.120.0060.00317.00
8.0.110.0050.00217.09
8.0.100.0000.00716.82
8.0.90.0040.00416.90
8.0.80.0110.01116.93
8.0.70.0040.00417.04
8.0.60.0000.00817.04
8.0.50.0000.00717.02
8.0.30.0110.00917.19
8.0.20.0090.01017.40
8.0.10.0040.00417.05
8.0.00.0110.00616.98
7.4.330.0060.00015.00
7.4.320.0030.00316.62
7.4.300.0030.00316.64
7.4.290.0070.00016.63
7.4.280.0080.00016.67
7.4.270.0000.00716.63
7.4.260.0030.00316.49
7.4.250.0060.00316.44
7.4.240.0040.00416.57
7.4.230.0000.00716.65
7.4.220.0130.00716.73
7.4.210.0120.00916.57
7.4.200.0040.00416.64
7.4.160.0150.00016.43
7.4.150.0170.00717.40
7.4.140.0090.00917.86
7.4.130.0090.00916.60
7.4.120.0120.00916.66
7.4.110.0100.00716.66
7.4.100.0060.01316.46
7.4.90.0100.00716.39
7.4.80.0110.00719.39
7.4.70.0120.00616.43
7.4.60.0100.00716.52
7.4.50.0000.00716.52
7.4.40.0060.01016.59
7.4.30.0070.01116.79
7.4.00.0060.01014.87
7.3.330.0000.00513.45
7.3.320.0000.00713.45
7.3.310.0030.00316.44
7.3.300.0030.00316.38
7.3.290.0070.00716.48
7.3.280.0030.01216.44
7.3.270.0110.00717.40
7.3.260.0090.00916.47
7.3.250.0120.00816.51
7.3.240.0100.01316.70
7.3.230.0040.01216.43
7.3.210.0060.01616.47
7.3.200.0090.01219.39
7.3.190.0120.00616.34
7.3.180.0160.00016.66
7.3.170.0120.00616.65
7.3.160.0090.01216.56
7.2.330.0160.00616.51
7.2.320.0110.00816.42
7.2.310.0120.00816.57
7.2.300.0130.00316.81
7.2.290.0110.00716.63
7.2.60.0200.00615.96
7.2.00.0000.01219.65
7.1.200.0030.00915.61
7.1.100.0060.00618.37
7.1.70.0110.00317.34
7.1.60.0070.01319.32
7.1.50.0040.01917.10
7.1.00.0070.07322.36
7.0.200.0000.01116.88
7.0.140.0130.06322.08
7.0.60.0100.05719.85
7.0.50.0070.05717.89
7.0.40.0000.04720.18
7.0.30.0230.05720.06
7.0.20.0330.08020.06
7.0.10.0370.05320.24
7.0.00.0030.07320.16
5.6.210.0100.07320.55
5.6.200.0030.06018.16
5.6.190.0070.04320.61
5.6.180.3530.04020.35
5.6.170.0330.03720.56
5.6.160.0130.08020.54
5.6.150.0130.07718.24
5.6.140.0070.06318.28
5.6.130.0000.04318.18
5.6.120.0130.05721.04
5.6.110.0130.05721.16
5.6.100.0170.07321.03
5.6.90.0000.04721.14
5.6.80.0130.08020.56
5.6.70.4170.03320.55
5.5.350.0300.06320.36
5.5.340.0030.07017.99
5.5.330.0030.05720.27
5.5.320.0230.04020.34
5.5.310.0230.08020.41
5.5.300.0030.08018.02
5.5.290.0070.06717.97
5.5.280.0070.08020.78
5.5.270.0100.06720.81
5.5.260.0070.09020.99
5.5.250.0170.07020.72
5.5.240.0200.06720.20
5.4.450.0170.03719.57
5.4.440.0530.06319.26
5.4.430.0600.06319.43
5.4.420.0670.00019.52
5.4.410.0630.00019.32
5.4.400.0630.00019.07
5.4.390.0630.00019.13
5.4.380.0630.00019.03
5.4.370.0700.00019.05
5.4.360.0630.00019.11
5.4.350.0630.00019.11
5.4.340.0040.03512.04
5.4.320.0100.03212.53
5.4.310.0050.03912.52
5.4.300.0060.03512.53
5.4.290.0060.04712.52
5.4.280.0070.03712.42
5.4.270.0040.03712.42
5.4.260.0020.04112.43
5.4.250.0090.03412.42
5.4.240.0070.03812.42
5.4.230.0040.03812.41
5.4.220.0060.03512.42
5.4.210.0060.04212.41
5.4.200.0070.03412.41
5.4.190.0080.03312.41
5.4.180.0080.03312.41
5.4.170.0020.03912.41
5.4.160.0030.04112.41
5.4.150.0040.03812.41
5.4.140.0070.04112.09
5.4.130.0070.04512.08
5.4.120.0050.03812.04
5.4.110.0060.04012.04
5.4.100.0060.04012.04
5.4.90.0040.03712.04
5.4.80.0060.03612.03
5.4.70.0070.03712.03
5.4.60.0050.03812.04
5.4.50.0070.03412.03
5.4.40.0050.03512.02
5.4.30.0030.04112.02
5.4.20.0060.03512.02
5.4.10.0030.03712.02
5.4.00.0050.03711.51
5.3.290.0050.04012.80
5.3.280.0080.03512.71
5.3.270.0040.04112.72
5.3.260.0050.03912.72
5.3.250.0060.03712.72
5.3.240.0060.03612.72
5.3.230.0060.03812.71
5.3.220.0080.03312.68
5.3.210.0040.03912.68
5.3.200.0090.03212.68
5.3.190.0050.04712.68
5.3.180.0070.04012.67
5.3.170.0040.03912.67
5.3.160.0060.03512.68
5.3.150.0050.03712.67
5.3.140.0070.03512.66
5.3.130.0070.03912.66
5.3.120.0070.04612.66
5.3.110.0050.04212.66
5.3.100.0050.03812.13
5.3.90.0080.03312.11
5.3.80.0040.04412.09
5.3.70.0070.03912.09
5.3.60.0100.03112.08
5.3.50.0050.03812.02
5.3.40.0050.03512.02
5.3.30.0050.03411.98
5.3.20.0030.03811.76
5.3.10.0090.03911.74
5.3.00.0030.04411.71
5.2.170.0030.0319.21
5.2.160.0080.0259.22
5.2.150.0040.0309.22
5.2.140.0030.0329.22
5.2.130.0040.0309.18
5.2.120.0030.0299.18
5.2.110.0050.0349.18
5.2.100.0020.0319.18
5.2.90.0050.0319.17
5.2.80.0050.0309.18
5.2.70.0040.0319.17
5.2.60.0050.0299.13
5.2.50.0030.0329.09
5.2.40.0050.0279.07
5.2.30.0050.0299.05
5.2.20.0050.0279.04
5.2.10.0040.0298.95
5.2.00.0060.0278.81
5.1.60.0030.0248.09
5.1.50.0030.0288.09
5.1.40.0030.0278.07
5.1.30.0060.0268.42
5.1.20.0080.0308.44
5.1.10.0070.0348.17
5.1.00.0030.0338.17
5.0.50.0020.0216.64
5.0.40.0030.0236.50
5.0.30.0060.0296.31
5.0.20.0020.0206.29
5.0.10.0030.0266.26
5.0.00.0050.0296.25
4.4.90.0030.0214.78
4.4.80.0020.0154.76
4.4.70.0040.0154.75
4.4.60.0050.0134.75
4.4.50.0020.0194.77
4.4.40.0030.0244.71
4.4.30.0040.0154.76
4.4.20.0030.0154.85
4.4.10.0020.0224.85
4.4.00.0030.0244.76
4.3.110.0030.0224.66
4.3.100.0010.0164.67
4.3.90.0050.0144.64
4.3.80.0030.0234.58
4.3.70.0040.0134.63
4.3.60.0040.0154.63
4.3.50.0040.0174.63
4.3.40.0050.0314.54
4.3.30.0010.0173.30
4.3.20.0040.0143.27
4.3.10.0010.0163.24
4.3.00.0070.03012.63

preferences:
48.61 ms | 400 KiB | 5 Q