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)) { $message[$i] = ''; $count++; } } return ['message' => $message, 'replacements' => $count]; } $msg = "усский алфавит"; $tmp = ' '; while ($tmp != $msg) { $tmp = stripNonValidCharaters($msg); $msg = $tmp['message']; } var_dump($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.60.0080.00618.56
8.3.50.0120.00821.96
8.3.40.0040.01118.79
8.3.30.0060.00918.95
8.3.20.0070.00020.16
8.3.10.0000.00723.52
8.3.00.0080.00319.38
8.2.180.0120.00918.29
8.2.170.0110.00422.96
8.2.160.0140.00020.39
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0000.00922.18
8.2.110.0050.00520.97
8.2.100.0060.00617.84
8.2.90.0000.00817.97
8.2.80.0040.00417.97
8.2.70.0040.00417.75
8.2.60.0000.00818.03
8.2.50.0060.00318.07
8.2.40.0040.00420.01
8.2.30.0070.00018.13
8.2.20.0080.00017.83
8.2.10.0070.00018.20
8.2.00.0030.00617.78
8.1.280.0130.00725.92
8.1.270.0060.00323.67
8.1.260.0140.00026.35
8.1.250.0090.00028.09
8.1.240.0040.00422.42
8.1.230.0070.00420.92
8.1.220.0050.00317.74
8.1.210.0000.01118.77
8.1.200.0040.00417.23
8.1.190.0040.00417.35
8.1.180.0000.00718.10
8.1.170.0040.00418.56
8.1.160.0040.00422.03
8.1.150.0040.00418.84
8.1.140.0050.00217.34
8.1.130.0030.00317.72
8.1.120.0000.00817.53
8.1.110.0030.00617.52
8.1.100.0040.00417.48
8.1.90.0070.00017.48
8.1.80.0040.00417.39
8.1.70.0030.00517.45
8.1.60.0050.00317.53
8.1.50.0060.00317.55
8.1.40.0000.00817.43
8.1.30.0040.00417.65
8.1.20.0060.00317.61
8.1.10.0000.00817.63
8.1.00.0040.00417.49
8.0.300.0000.00719.90
8.0.290.0000.00716.88
8.0.280.0000.00818.37
8.0.270.0030.00317.21
8.0.260.0050.00217.23
8.0.250.0000.00717.00
8.0.240.0030.00316.96
8.0.230.0000.00717.07
8.0.220.0030.00417.00
8.0.210.0030.00316.98
8.0.200.0030.00516.87
8.0.190.0040.00417.05
8.0.180.0000.00716.91
8.0.170.0050.00317.00
8.0.160.0050.00316.89
8.0.150.0040.00416.77
8.0.140.0000.00716.91
8.0.130.0000.00613.44
8.0.120.0060.00316.83
8.0.110.0040.00416.89
8.0.100.0050.00316.88
8.0.90.0000.00716.82
8.0.80.0120.00617.04
8.0.70.0030.00516.84
8.0.60.0040.00416.99
8.0.50.0040.00416.92
8.0.30.0140.01117.23
8.0.20.0090.00917.40
8.0.10.0050.00317.10
8.0.00.0070.01316.74
7.4.330.0030.00315.15
7.4.320.0060.00016.47
7.4.300.0060.00016.46
7.4.290.0000.00816.46
7.4.280.0000.00816.30
7.4.270.0030.00316.29
7.4.260.0000.00716.34
7.4.250.0080.00016.44
7.4.240.0020.00516.35
7.4.230.0000.00716.39
7.4.220.0160.00316.45
7.4.210.0000.01716.59
7.4.200.0000.00716.29
7.4.160.0060.01916.28
7.4.150.0080.01317.40
7.4.140.0220.00317.86
7.4.130.0100.01716.55
7.4.120.0100.01116.44
7.4.110.0200.00016.51
7.4.100.0110.00716.20
7.4.90.0090.00916.31
7.4.80.0100.00719.39
7.4.70.0120.00716.32
7.4.60.0110.01116.50
7.4.50.0040.00416.50
7.4.40.0130.01016.34
7.4.30.0140.00716.52
7.4.00.0030.01015.03
7.3.330.0030.00313.39
7.3.320.0030.00313.29
7.3.310.0030.00316.13
7.3.300.0030.00316.33
7.3.290.0150.00416.32
7.3.280.0090.01016.36
7.3.270.0130.00917.40
7.3.260.0130.00616.42
7.3.240.0090.00916.48
7.3.230.0060.01216.39
7.3.210.0060.01616.58
7.3.200.0030.01719.39
7.3.190.0120.01516.24
7.3.180.0040.01716.42
7.3.170.0120.00616.28
7.3.160.0130.00616.43
7.2.330.0130.00716.45
7.2.320.0130.00816.66
7.2.310.0150.00516.49
7.2.300.0110.00816.78
7.2.290.0070.01416.77
7.2.60.0070.00717.05
7.2.00.0030.00919.49
7.1.200.0040.00415.79
7.1.100.0030.01017.82
7.1.70.0050.00217.09
7.1.60.0090.01519.32
7.1.50.0130.01317.14
7.1.00.0030.07722.24
7.0.200.1472.35316.86
7.0.140.0072.49322.07
7.0.60.0032.49720.02
7.0.50.0032.49717.84
7.0.40.0072.49319.86
7.0.30.0432.45719.89
7.0.20.0372.46319.81
7.0.10.0102.49019.69
7.0.00.0072.49319.95
5.6.210.0102.49020.73
5.6.200.0102.49018.18
5.6.190.0032.49720.34
5.6.180.0172.48320.45
5.6.170.0332.46720.39
5.6.160.0132.48720.38
5.6.150.0102.49018.16
5.6.140.0172.48318.16
5.6.130.0032.49718.20
5.6.120.0102.49020.77
5.6.110.0102.49021.02
5.6.100.0002.50021.20
5.6.90.0032.49721.00
5.6.80.0072.49320.43
5.5.350.0102.49020.42
5.5.340.0102.49018.07
5.5.330.0172.48320.14
5.5.320.0432.45720.20
5.5.310.0332.46720.26
5.5.300.0032.49717.96
5.5.290.0072.49318.06
5.5.280.0102.49020.68
5.5.270.0072.49320.88
5.5.260.0172.48321.00
5.5.250.0072.49320.48
5.5.240.0232.47720.38
5.4.450.1002.28019.45
5.4.440.0302.46019.30
5.4.430.0172.45319.66
5.4.422.3270.00019.46
5.4.412.3270.00019.21
5.4.402.4900.00019.07
5.4.392.4830.00019.09
5.4.382.4330.00019.02
5.4.372.4070.00019.06
5.4.362.4900.00019.02
5.4.352.4900.00019.00
5.4.340.0041.99812.04
5.4.320.0071.99412.53
5.4.310.0051.99612.52
5.4.300.0071.99612.53
5.4.290.0091.99212.52
5.4.280.0101.99112.43
5.4.270.0041.99812.42
5.4.260.0072.00012.42
5.4.250.0041.99812.42
5.4.240.0081.99112.43
5.4.230.0381.97512.41
5.4.220.0441.96112.41
5.4.210.0081.99212.41
5.4.200.0321.97112.41
5.4.190.0201.98212.41
5.4.180.0101.99112.41
5.4.170.0101.99212.42
5.4.160.0051.99512.41
5.4.150.0111.99012.41
5.4.140.0081.99312.09
5.4.130.0091.99212.08
5.4.120.0071.99412.04
5.4.110.0091.99312.04
5.4.100.0052.00112.04
5.4.90.0121.99012.04
5.4.80.0111.99112.03
5.4.70.0061.99412.03
5.4.60.0081.99312.04
5.4.50.0051.99612.04
5.4.40.0071.99512.02
5.4.30.0041.99612.02
5.4.20.0081.99412.02
5.4.10.0081.99412.02
5.4.00.0091.99311.50
5.3.290.0090.04112.80
5.3.280.0020.04112.71
5.3.270.0090.03612.72
5.3.260.0100.03912.72
5.3.250.0060.03712.72
5.3.240.0050.03912.72
5.3.230.0070.03812.71
5.3.220.0060.03612.68
5.3.210.0040.04012.68
5.3.200.0050.03712.68
5.3.190.0060.03912.68
5.3.180.0050.03712.67
5.3.170.0050.03912.67
5.3.160.0050.03712.68
5.3.150.0050.03812.67
5.3.140.0070.03512.66
5.3.130.0080.03612.66
5.3.120.0030.04212.66
5.3.110.0040.04012.66
5.3.100.0050.03712.13
5.3.90.0080.03512.11
5.3.80.0070.03612.09
5.3.70.0060.03812.09
5.3.60.0080.03312.08
5.3.50.0050.03712.02
5.3.40.0060.03512.02
5.3.30.0030.03711.98
5.3.20.0070.03711.76
5.3.10.0080.03611.73
5.3.00.0040.03811.71
5.2.170.0040.0309.22
5.2.160.0080.0309.22
5.2.150.0060.0289.22
5.2.140.0070.0299.21
5.2.130.0070.0339.18
5.2.120.0030.0309.18
5.2.110.0030.0309.18
5.2.100.0040.0309.18
5.2.90.0060.0329.18
5.2.80.0030.0329.18
5.2.70.0050.0319.17
5.2.60.0060.0309.13
5.2.50.0080.0289.09
5.2.40.0030.0319.07
5.2.30.0050.0309.05
5.2.20.0050.0299.04
5.2.10.0050.0298.95
5.2.00.0040.0308.81
5.1.60.0080.0218.09
5.1.50.0040.0258.09
5.1.40.0040.0258.06
5.1.30.0060.0278.43
5.1.20.0040.0278.44
5.1.10.0060.0248.16
5.1.00.0030.0278.16
5.0.50.0050.0276.64
5.0.40.0040.0196.50
5.0.30.0030.0316.31
5.0.20.0030.0206.29
5.0.10.0040.0206.26
5.0.00.0030.0316.26
4.4.90.0020.0164.78
4.4.80.0020.0154.76
4.4.70.0010.0174.75
4.4.60.0020.0204.76
4.4.50.0050.0134.77
4.4.40.0010.0274.71
4.4.30.0030.0154.76
4.4.20.0030.0154.84
4.4.10.0030.0154.85
4.4.00.0000.0274.76
4.3.110.0040.0144.67
4.3.100.0010.0164.66
4.3.90.0060.0134.63
4.3.80.0020.0254.59
4.3.70.0040.0124.63
4.3.60.0030.0144.63
4.3.50.0030.0144.63
4.3.40.0000.0254.54
4.3.30.0030.0143.30
4.3.20.0030.0193.28
4.3.10.0010.0163.24
4.3.00.0130.0238.11

preferences:
35.83 ms | 401 KiB | 5 Q