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)) { var_dump(ord($message[$i])); $message[$i] = ''; $count++; } } return ['message' => $message, 'replacements' => $count]; } $msg = "Dear Alex Here are some funky characters sdfjsdfj sldfj sd !!?!?>)SD(*ASD09 усский алфавит T"; $tmp = ' '; while ($tmp != $msg) { $msg = $tmp; $tmp = stripNonValidCharaters($msg); } 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.0100.00318.68
8.3.50.0150.00722.18
8.3.40.0180.00418.82
8.3.30.0120.00418.86
8.3.20.0070.00020.21
8.3.10.0080.00023.53
8.3.00.0030.00619.38
8.2.180.0140.00716.63
8.2.170.0070.00722.96
8.2.160.0100.00320.32
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00422.05
8.2.110.0080.00820.27
8.2.100.0060.00618.22
8.2.90.0060.00319.14
8.2.80.0040.00417.97
8.2.70.0030.00617.50
8.2.60.0090.00017.91
8.2.50.0040.00418.07
8.2.40.0060.00319.93
8.2.30.0040.00418.11
8.2.20.0020.00517.87
8.2.10.0040.00418.04
8.2.00.0070.00017.74
8.1.280.0180.00325.92
8.1.270.0050.00323.77
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00623.91
8.1.230.0080.00318.98
8.1.220.0080.00017.75
8.1.210.0000.00818.77
8.1.200.0000.01017.35
8.1.190.0000.00917.23
8.1.180.0060.00318.10
8.1.170.0060.00318.65
8.1.160.0040.00422.03
8.1.150.0060.00318.89
8.1.140.0000.00720.59
8.1.130.0030.00317.79
8.1.120.0040.00417.37
8.1.110.0020.00517.42
8.1.100.0030.00417.45
8.1.90.0000.00717.51
8.1.80.0050.00317.51
8.1.70.0030.00317.35
8.1.60.0030.00517.52
8.1.50.0060.00317.53
8.1.40.0050.00217.40
8.1.30.0030.00617.65
8.1.20.0000.00717.58
8.1.10.0040.00417.59
8.1.00.0000.00717.45
8.0.300.0000.00718.77
8.0.290.0000.00716.73
8.0.280.0000.00718.46
8.0.270.0060.00317.27
8.0.260.0030.00317.23
8.0.250.0070.00017.01
8.0.240.0000.00716.92
8.0.230.0070.00017.07
8.0.220.0030.00416.90
8.0.210.0000.00716.96
8.0.200.0030.00316.92
8.0.190.0040.00417.05
8.0.180.0070.00016.99
8.0.170.0080.00016.93
8.0.160.0000.00716.84
8.0.150.0000.00716.94
8.0.140.0050.00316.82
8.0.130.0000.00513.43
8.0.120.0000.00817.03
8.0.110.0040.00417.00
8.0.100.0040.00416.76
8.0.90.0070.00017.08
8.0.80.0110.01117.03
8.0.70.0070.00016.91
8.0.60.0030.00617.00
8.0.50.0040.00316.83
8.0.30.0110.01016.99
8.0.20.0140.00617.42
8.0.10.0040.00416.98
8.0.00.0140.00516.87
7.4.330.0040.00415.00
7.4.320.0060.00316.72
7.4.300.0000.00916.64
7.4.290.0030.00716.53
7.4.280.0060.00616.70
7.4.270.0030.00716.70
7.4.260.0100.00016.47
7.4.250.0110.00016.62
7.4.240.0060.00316.73
7.4.230.0030.00616.59
7.4.220.0090.01616.71
7.4.210.0060.01616.77
7.4.200.0070.00316.69
7.4.160.0160.01916.67
7.4.150.0110.01717.40
7.4.140.0170.00917.86
7.4.130.0120.01516.70
7.4.120.0220.02916.82
7.4.110.0220.01416.43
7.4.100.0150.00916.78
7.4.90.0170.00916.77
7.4.80.0150.00919.39
7.4.70.0080.01716.71
7.4.60.0260.01216.68
7.4.50.0060.00616.70
7.4.40.0160.00616.45
7.4.30.0200.00816.82
7.4.00.0100.01015.14
7.3.330.0040.00413.67
7.3.320.0080.00013.64
7.3.310.0060.00316.53
7.3.300.0030.00716.53
7.3.290.0090.01416.49
7.3.280.0070.01516.52
7.3.270.0080.02017.40
7.3.260.0120.02616.43
7.3.250.0070.01816.52
7.3.240.0150.01716.69
7.3.230.0060.01516.55
7.3.210.0140.01416.68
7.3.200.0210.01419.39
7.3.190.0100.02616.49
7.3.180.0060.01516.44
7.3.170.0150.00616.64
7.3.160.0100.01316.73
7.2.330.0230.00816.93
7.2.320.0060.02516.91
7.2.310.0140.01116.63
7.2.300.0160.01016.91
7.2.290.0090.01916.57
7.2.60.0090.00917.03
7.2.00.0000.01519.54
7.1.200.0060.01315.90
7.1.100.0040.01117.99
7.1.70.0000.00917.21
7.1.60.0140.01719.32
7.1.50.0090.01917.25
7.1.00.0030.08022.39
7.0.200.0030.01216.75
7.0.140.0000.08322.01
7.0.60.0100.07720.09
7.0.50.0070.07018.02
7.0.40.0170.07719.95
7.0.30.0300.04020.07
7.0.20.0370.07720.06
7.0.10.0330.05720.08
7.0.00.0130.08320.03
5.6.280.0070.07721.40
5.6.210.0070.07720.86
5.6.200.0070.04318.53
5.6.190.0100.06020.65
5.6.180.3600.04020.66
5.6.170.0270.07320.62
5.6.160.0130.03720.61
5.6.150.0030.04718.39
5.6.140.0070.08718.41
5.6.130.0100.03718.41
5.6.120.0170.08321.32
5.6.110.0030.10321.29
5.6.100.0130.05321.29
5.6.90.0000.04721.25
5.6.80.0130.08320.68
5.6.70.4430.04720.78
5.5.350.0300.08020.70
5.5.340.0100.06718.29
5.5.330.0030.08320.46
5.5.320.0230.04320.50
5.5.310.0270.08020.53
5.5.300.0130.08018.33
5.5.290.0030.09318.30
5.5.280.0130.05021.14
5.5.270.0100.09021.10
5.5.260.0070.08721.03
5.5.250.0170.07321.08
5.5.240.0070.08020.46
5.4.450.1470.04319.40
5.4.440.0700.05319.55
5.4.430.0870.08319.67
5.4.420.0770.00019.75
5.4.410.0770.00019.65
5.4.400.0730.00019.30
5.4.390.0730.00019.21
5.4.380.0770.00019.46
5.4.370.0730.00019.38
5.4.360.0730.00019.31
5.4.350.0730.00019.36
5.4.340.0080.03912.30
5.4.320.0080.04012.79
5.4.310.0080.04212.79
5.4.300.0060.04312.79
5.4.290.0060.04512.78
5.4.280.0070.04212.68
5.4.270.0070.04412.68
5.4.260.0060.04512.68
5.4.250.0130.03812.68
5.4.240.0130.03812.68
5.4.230.0060.04712.67
5.4.220.0080.04112.68
5.4.210.0080.04212.67
5.4.200.0080.04412.68
5.4.190.0110.04012.67
5.4.180.0110.04312.67
5.4.170.0070.04212.69
5.4.160.0080.04312.68
5.4.150.0030.04512.68
5.4.140.0100.04112.36
5.4.130.0090.04012.35
5.4.120.0070.04112.32
5.4.110.0100.03912.30
5.4.100.0090.04512.31
5.4.90.0070.04312.30
5.4.80.0070.04412.30
5.4.70.0140.04312.30
5.4.60.0080.04312.29
5.4.50.0090.04312.30
5.4.40.0090.04312.29
5.4.30.0080.04212.29
5.4.20.0090.04112.28
5.4.10.0070.04112.28
5.4.00.0060.04111.77
5.3.290.0070.03812.80
5.3.280.0030.04012.70
5.3.270.0060.04012.73
5.3.260.0050.04012.72
5.3.250.0070.04412.72
5.3.240.0070.03412.72
5.3.230.0070.03512.71
5.3.220.0070.03512.68
5.3.210.0060.03712.68
5.3.200.0090.03112.68
5.3.190.0020.04012.68
5.3.180.0070.03612.68
5.3.170.0070.03512.67
5.3.160.0060.03612.68
5.3.150.0060.03712.68
5.3.140.0080.04112.66
5.3.130.0090.03512.66
5.3.120.0030.04412.65
5.3.110.0080.03612.66
5.3.100.0070.03712.13
5.3.90.0060.03612.11
5.3.80.0100.03212.09
5.3.70.0070.03812.09
5.3.60.0060.03412.08
5.3.50.0030.03712.02
5.3.40.0080.04112.02
5.3.30.0070.03411.98
5.3.20.0060.04311.76
5.3.10.0040.03611.74
5.3.00.0050.03611.72
5.2.170.0060.0299.22
5.2.160.0050.0299.22
5.2.150.0060.0359.23
5.2.140.0040.0329.22
5.2.130.0040.0299.18
5.2.120.0040.0339.18
5.2.110.0070.0269.19
5.2.100.0060.0269.17
5.2.90.0050.0279.18
5.2.80.0080.0269.17
5.2.70.0040.0399.17
5.2.60.0060.0329.13
5.2.50.0050.0319.10
5.2.40.0040.0319.07
5.2.30.0060.0339.05
5.2.20.0060.0339.04
5.2.10.0040.0348.95
5.2.00.0110.0258.80
5.1.60.0050.0278.09
5.1.50.0080.0338.09
5.1.40.0070.0338.07
5.1.30.0090.0238.42
5.1.20.0030.0298.43
5.1.10.0070.0328.16
5.1.00.0050.0258.16
5.0.50.0040.0226.64
5.0.40.0050.0186.50
5.0.30.0040.0306.31
5.0.20.0040.0236.29
5.0.10.0040.0216.26
5.0.00.0010.0356.25
4.4.90.0030.0154.78
4.4.80.0030.0154.76
4.4.70.0050.0134.75
4.4.60.0040.0144.76
4.4.50.0020.0164.77
4.4.40.0060.0344.71
4.4.30.0020.0174.76
4.4.20.0050.0144.85
4.4.10.0020.0174.85
4.4.00.0030.0254.76
4.3.110.0010.0174.67
4.3.100.0030.0144.67
4.3.90.0040.0144.63
4.3.80.0020.0264.58
4.3.70.0030.0144.63
4.3.60.0020.0154.62
4.3.50.0040.0174.63
4.3.40.0020.0244.54
4.3.30.0020.0163.30
4.3.20.0030.0213.27
4.3.10.0020.0183.24
4.3.00.0430.02014.27

preferences:
39.77 ms | 401 KiB | 5 Q