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 = "Dear Alex Here are some funky characters sdfjsdfj sldfj sd !!?!?>)SD(*ASD09 усский алфавит T"; var_dump(stripNonValidCharaters($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.70.0150.00418.38
8.3.60.0110.00718.68
8.3.50.0140.00821.03
8.3.40.0110.00418.67
8.3.30.0110.00419.02
8.3.20.0000.00720.21
8.3.10.0090.00021.73
8.3.00.0070.00319.25
8.2.180.0140.00718.65
8.2.170.0070.00722.96
8.2.160.0100.00720.52
8.2.150.0000.00824.18
8.2.140.0030.00524.66
8.2.130.0080.00026.16
8.2.120.0080.00022.13
8.2.110.0040.00722.25
8.2.100.0040.00817.63
8.2.90.0000.00719.36
8.2.80.0030.00517.97
8.2.70.0060.00617.75
8.2.60.0040.00418.04
8.2.50.0040.00418.07
8.2.40.0000.00819.95
8.2.30.0040.00418.17
8.2.20.0040.00417.70
8.2.10.0040.00418.02
8.2.00.0000.00717.69
8.1.280.0120.00325.92
8.1.270.0000.00823.83
8.1.260.0080.00026.35
8.1.250.0100.00328.09
8.1.240.0000.00923.79
8.1.230.0120.00017.48
8.1.220.0040.00417.78
8.1.210.0050.00318.77
8.1.200.0090.00017.13
8.1.190.0050.00317.23
8.1.180.0090.00018.10
8.1.170.0080.00018.70
8.1.160.0040.00422.07
8.1.150.0050.00318.87
8.1.140.0000.00717.46
8.1.130.0000.00717.84
8.1.120.0000.00717.50
8.1.110.0050.00317.46
8.1.100.0050.00217.52
8.1.90.0050.00217.48
8.1.80.0050.00317.44
8.1.70.0030.00317.44
8.1.60.0030.00617.62
8.1.50.0030.00617.60
8.1.40.0030.00617.53
8.1.30.0050.00317.64
8.1.20.0040.00417.60
8.1.10.0040.00417.55
8.1.00.0060.00317.50
8.0.300.0070.00018.77
8.0.290.0020.00516.88
8.0.280.0000.00718.35
8.0.270.0000.00718.09
8.0.260.0030.00317.28
8.0.250.0030.00517.05
8.0.240.0030.00316.95
8.0.230.0030.00316.99
8.0.220.0030.00316.98
8.0.210.0000.00616.95
8.0.200.0000.00817.00
8.0.190.0000.00717.01
8.0.180.0000.00817.00
8.0.170.0050.00317.00
8.0.160.0070.00016.86
8.0.150.0000.00716.97
8.0.140.0000.00716.98
8.0.130.0000.00613.43
8.0.120.0030.00516.91
8.0.110.0040.00416.88
8.0.100.0050.00216.96
8.0.90.0020.00517.02
8.0.80.0090.00616.97
8.0.70.0050.00217.02
8.0.60.0000.00816.98
8.0.50.0040.00416.89
8.0.30.0080.01517.13
8.0.20.0130.00817.40
8.0.10.0040.00417.16
8.0.00.0060.01116.66
7.4.330.0000.00515.00
7.4.320.0030.00316.66
7.4.300.0000.00616.65
7.4.290.0030.00316.50
7.4.280.0060.00316.56
7.4.270.0030.00316.52
7.4.260.0030.00416.57
7.4.250.0050.00216.37
7.4.240.0020.00516.56
7.4.230.0040.00416.72
7.4.220.0040.00416.66
7.4.210.0110.00416.55
7.4.200.0040.00416.53
7.4.160.0120.00416.48
7.4.150.0040.01417.40
7.4.140.0110.00817.86
7.4.130.0160.00316.56
7.4.120.0100.00716.53
7.4.110.0090.01016.58
7.4.100.0040.01316.52
7.4.90.0080.00816.41
7.4.80.0070.01119.39
7.4.70.0150.00416.48
7.4.60.0130.00916.57
7.4.50.0040.00416.37
7.4.40.0100.00716.47
7.4.30.0080.00816.47
7.4.10.0040.01515.07
7.4.00.0080.00915.04
7.3.330.0000.00613.48
7.3.320.0030.00313.28
7.3.310.0030.00316.42
7.3.300.0070.00016.34
7.3.290.0150.00316.45
7.3.280.0080.00916.43
7.3.270.0090.00917.40
7.3.260.0110.00816.55
7.3.240.0070.01116.43
7.3.230.0120.00616.59
7.3.210.0100.00716.51
7.3.200.0080.01619.39
7.3.190.0180.00016.47
7.3.180.0080.00816.62
7.3.170.0080.00816.52
7.3.160.0080.00916.44
7.3.130.0000.01914.72
7.3.120.0040.01515.01
7.3.110.0030.00915.15
7.3.100.0080.00414.68
7.3.90.0090.00614.93
7.3.80.0040.00714.64
7.3.70.0030.01014.75
7.3.60.0090.00614.76
7.3.50.0060.00314.91
7.3.40.0120.00314.72
7.3.30.0060.00614.98
7.3.20.0000.01516.78
7.3.10.0040.01116.76
7.3.00.0070.01016.71
7.2.330.0090.00916.47
7.2.320.0090.01216.67
7.2.310.0090.00916.73
7.2.300.0140.00316.88
7.2.290.0170.00016.56
7.2.260.0110.00715.25
7.2.250.0100.00715.28
7.2.240.0070.01014.85
7.2.230.0050.00514.82
7.2.220.0070.00715.34
7.2.210.0060.00315.00
7.2.200.0030.01014.72
7.2.190.0070.00715.08
7.2.180.0030.01015.13
7.2.170.0030.01014.82
7.2.160.0070.00315.04
7.2.150.0120.00316.77
7.2.140.0030.01016.76
7.2.130.0030.01016.97
7.2.120.0110.00316.88
7.2.110.0120.00316.98
7.2.100.0030.01016.66
7.2.90.0030.00616.97
7.2.80.0030.00717.04
7.2.70.0070.01017.07
7.2.60.0070.00716.91
7.2.50.0120.00316.80
7.2.40.0080.00316.95
7.2.30.0070.01017.09
7.2.20.0100.01016.75
7.2.10.0100.01016.89
7.2.00.0050.00718.29
7.1.330.0030.01215.75
7.1.320.0030.00915.74
7.1.310.0070.00715.84
7.1.300.0060.00615.92
7.1.290.0120.00315.90
7.1.280.0070.00415.84
7.1.270.0080.00415.65
7.1.260.0100.00715.96
7.1.250.0030.01015.53
7.1.240.0030.01315.82
7.1.230.0070.01015.65
7.1.220.0110.00315.86
7.1.210.0100.00315.79
7.1.200.0090.00415.78
7.1.190.0070.00415.68
7.1.180.0030.01015.94
7.1.170.0030.00615.74
7.1.160.0070.00715.89
7.1.150.0030.01015.72
7.1.140.0000.01515.58
7.1.130.0000.00915.76
7.1.120.0060.00915.82
7.1.110.0030.01215.81
7.1.100.0050.00516.87
7.1.90.0140.00315.93
7.1.80.0000.01716.00
7.1.70.0030.00916.42
7.1.60.0030.01717.56
7.1.50.0070.01216.33
7.1.40.0040.00715.95
7.1.30.0000.01315.59
7.1.20.0070.00415.83
7.1.10.0000.01515.90
7.1.00.0050.04219.11
7.0.330.0030.01015.36
7.0.320.0070.00315.48
7.0.310.0030.01015.34
7.0.300.0060.00615.24
7.0.290.0170.00015.65
7.0.280.0110.00315.29
7.0.270.0060.00315.38
7.0.260.0000.01415.39
7.0.250.0000.01315.48
7.0.240.0060.00615.10
7.0.230.0110.00015.55
7.0.220.0070.00715.42
7.0.210.0030.01215.48
7.0.200.0070.00416.03
7.0.190.0070.00715.54
7.0.180.0070.00715.46
7.0.170.0000.01615.31
7.0.160.0040.01115.24
7.0.150.0060.00615.44
7.0.140.0080.03618.83
7.0.130.0030.01015.61
7.0.120.0040.00715.41
7.0.110.0000.00815.17
7.0.100.0040.00715.41
7.0.90.0040.00415.56
7.0.80.0090.00615.11
7.0.70.0030.01015.49
7.0.60.0070.04017.72
7.0.50.0030.04716.61
7.0.40.0030.03716.82
7.0.30.0120.04016.92
7.0.20.0140.03116.90
7.0.10.0080.04216.87
7.0.00.0070.04916.87
5.6.400.0060.00914.52
5.6.390.0110.00014.38
5.6.380.0080.00314.52
5.6.370.0090.00414.71
5.6.360.0030.01014.46
5.6.350.0030.00614.51
5.6.340.0070.00714.16
5.6.330.0040.00714.79
5.6.320.0000.00914.40
5.6.310.0060.00614.45
5.6.300.0030.01314.48
5.6.290.0060.00914.40
5.6.280.0030.04017.70
5.6.270.0030.01214.69
5.6.260.0000.00914.73
5.6.250.0070.00713.98
5.6.240.0030.01214.39
5.6.230.0030.00614.39
5.6.220.0000.01314.41
5.6.210.0070.03517.34
5.6.200.0050.02416.37
5.6.190.0060.02917.47
5.6.180.0210.02617.47
5.6.170.0260.04017.45
5.6.160.0070.02517.32
5.6.150.0060.04516.25
5.6.140.0100.04016.20
5.6.130.0070.02216.38
5.6.120.0020.03617.79
5.6.110.0030.03517.69
5.6.100.0040.03117.59
5.6.90.0050.04417.73
5.6.80.0120.03717.49
5.6.70.0110.00314.20
5.6.60.0090.00614.19
5.6.50.0000.01614.39
5.6.40.0040.01114.52
5.6.30.0030.00914.67
5.6.20.0040.01114.13
5.6.10.0070.00314.46
5.6.00.0000.01014.19
5.5.380.0060.00614.12
5.5.370.0070.00714.21
5.5.360.0000.01514.64
5.5.350.0040.02217.24
5.5.340.0040.03316.27
5.5.330.0060.04817.42
5.5.320.0070.02517.34
5.5.310.0210.02717.49
5.5.300.0050.04716.18
5.5.290.0020.04316.28
5.5.280.0030.03717.55
5.5.270.0080.04217.46
5.5.260.0080.04417.70
5.5.250.0120.03917.37
5.5.240.0050.03317.37
5.5.230.0030.01014.26
5.5.220.0030.01214.30
5.5.210.0060.01214.59
5.5.200.0030.01014.21
5.5.190.0040.01214.14
5.5.180.0060.00914.11
5.5.170.0060.00613.94
5.5.160.0040.00714.49
5.5.150.0030.01014.04
5.5.140.0100.00314.66
5.5.130.0000.01414.02
5.5.120.0030.01014.32
5.5.110.0000.01014.30
5.5.100.0060.00614.38
5.5.90.0040.01114.19
5.5.80.0000.01114.36
5.5.70.0000.00914.45
5.5.60.0030.00714.14
5.5.50.0100.00314.09
5.5.40.0000.01214.11
5.5.30.0000.00814.14
5.5.20.0030.01414.52
5.5.10.0030.01014.09
5.5.00.0000.01014.38
5.4.450.0250.02815.30
5.4.440.0180.02615.19
5.4.430.0170.02715.27
5.4.420.0200.02415.19
5.4.410.0270.03415.23
5.4.400.0230.01914.86
5.4.390.0180.02415.15
5.4.380.0270.03314.91
5.4.370.0180.02315.23
5.4.360.0130.02415.06
5.4.350.0200.02014.98
5.4.340.0150.02215.20
5.4.330.0100.00011.09
5.4.320.0130.02715.02
5.4.310.0170.02414.97
5.4.300.0210.02015.08
5.4.290.0200.01815.02
5.4.280.0180.01815.07
5.4.270.0180.01815.04
5.4.260.0180.01815.02
5.4.250.0180.01815.24
5.4.240.0200.02815.15
5.4.230.0250.03415.00
5.4.220.0170.02414.91
5.4.210.0190.02015.05
5.4.200.0180.02114.84
5.4.190.0240.02315.15
5.4.180.0180.02315.06
5.4.170.0180.02215.26
5.4.160.0150.02315.13
5.4.150.0200.02515.21
5.4.140.0180.02813.71
5.4.130.0200.02113.75
5.4.120.0150.02213.88
5.4.110.0170.02013.66
5.4.100.0160.02113.76
5.4.90.0130.02313.73
5.4.80.0180.02513.75
5.4.70.0170.02213.76
5.4.60.0170.03013.76
5.4.50.0230.02713.71
5.4.40.0240.02713.68
5.4.30.0230.03113.72
5.4.20.0300.02713.86
5.4.10.0180.02213.93
5.4.00.0200.03513.49
5.3.290.0330.03714.71
5.3.280.0330.03314.71
5.3.270.0330.03314.69
5.3.260.0300.03714.63
5.3.250.0300.03714.69
5.3.240.0300.03714.68
5.3.230.0470.04014.69
5.3.220.0400.02714.54
5.3.210.0330.03314.60
5.3.200.0270.04014.54
5.3.190.0270.04014.47
5.3.180.0400.04014.49
5.3.170.0430.06314.69
5.3.160.0270.05714.57
5.3.150.0370.05014.65
5.3.140.0370.04714.68
5.3.130.0400.06714.56
5.3.120.0400.06314.60
5.3.110.0400.03314.47
5.3.100.0470.06014.05
5.3.90.0400.04014.19
5.3.80.0370.04313.92
5.3.70.0370.03314.17
5.3.60.0400.04013.92
5.3.50.0300.04313.90
5.3.40.0470.06013.86
5.3.30.0470.06714.02
5.3.20.0400.03713.77
5.3.10.0400.04013.75
5.3.00.0500.06313.61
5.2.170.0430.04711.46
5.2.160.0430.05011.46
5.2.150.0370.03011.46
5.2.140.0400.04711.46
5.2.130.0400.05011.46
5.2.120.0300.03311.46
5.2.110.0300.03011.46
5.2.100.0370.03011.46
5.2.90.0300.03011.46
5.2.80.0370.03311.46
5.2.70.0470.05311.46
5.2.60.0500.04711.46
5.2.50.0370.04311.46
5.2.40.0270.05011.46
5.2.30.0270.03011.46
5.2.20.0330.05711.46
5.2.10.0400.02711.46
5.2.00.0270.05711.46
5.1.60.0430.04011.46
5.1.50.0370.04311.46
5.1.40.0270.03711.46
5.1.30.0330.03311.46
5.1.20.0330.04711.46
5.1.10.0270.05011.46
5.1.00.0330.04711.46
5.0.50.0130.02311.46
5.0.40.0230.03711.46
5.0.30.0170.05711.46
5.0.20.0170.04311.46
5.0.10.0130.04311.46
5.0.00.0130.06711.46
4.4.90.0200.02011.46
4.4.80.0170.03311.46
4.4.70.0130.02311.46
4.4.60.0170.01711.46
4.4.50.0270.02711.46
4.4.40.0170.04011.46
4.4.30.0100.02011.46
4.4.20.0230.03011.46
4.4.10.0200.02011.46
4.4.00.0170.05311.46
4.3.110.0130.02011.46
4.3.100.0130.02311.46
4.3.90.0200.03311.46
4.3.80.0170.05011.46
4.3.70.0170.03311.46
4.3.60.0100.02311.46
4.3.50.0170.03011.46
4.3.40.0100.04311.46
4.3.30.0070.02311.46
4.3.20.0070.01711.46
4.3.10.0100.03311.46
4.3.00.0100.01711.46

preferences:
67.57 ms | 401 KiB | 5 Q