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)); for($i = 0; $i < strlen($msg); $i++) { var_dump(hexdec(bin2hex(mb_substr($msg, $i, 1)))); }

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.0070.00718.30
8.3.50.0140.00317.96
8.3.40.0040.01118.84
8.3.30.0070.00719.08
8.3.20.0070.00020.29
8.3.10.0000.00923.53
8.3.00.0090.00317.63
8.2.180.0040.01218.42
8.2.170.0150.00619.08
8.2.160.0090.00622.96
8.2.150.0060.00324.18
8.2.140.0090.00024.66
8.2.130.0050.00226.16
8.2.120.0070.00022.05
8.2.110.0000.00922.25
8.2.100.0090.00317.62
8.2.90.0050.00319.25
8.2.80.0000.00817.97
8.2.70.0090.00317.75
8.2.60.0000.00817.91
8.2.50.0040.00418.07
8.2.40.0030.00519.94
8.2.30.0000.00718.20
8.2.20.0040.00417.83
8.2.10.0000.00718.20
8.2.00.0050.00517.82
8.1.270.0080.00022.18
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00423.82
8.1.230.0120.00019.26
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0100.00017.23
8.1.190.0040.00417.22
8.1.180.0040.00418.10
8.1.170.0030.00518.52
8.1.160.0070.00022.05
8.1.150.0070.00018.91
8.1.140.0060.00317.47
8.1.130.0030.00317.74
8.1.120.0040.00417.55
8.1.110.0040.00417.30
8.1.100.0000.00717.48
8.1.90.0000.00717.42
8.1.80.0040.00417.42
8.1.70.0000.00717.36
8.1.60.0090.00017.61
8.1.50.0040.00417.45
8.1.40.0040.00417.54
8.1.30.0040.00417.68
8.1.20.0050.00317.59
8.1.10.0040.00417.62
8.1.00.0040.00417.48
8.0.300.0000.00818.77
8.0.290.0070.00016.75
8.0.280.0000.00718.41
8.0.270.0000.00717.43
8.0.260.0030.00317.28
8.0.250.0070.00016.96
8.0.240.0030.00316.95
8.0.230.0030.00317.11
8.0.220.0000.00716.97
8.0.210.0000.00716.93
8.0.200.0030.00617.02
8.0.190.0040.00416.97
8.0.180.0000.00717.07
8.0.170.0040.00416.95
8.0.160.0070.00016.99
8.0.150.0000.00717.04
8.0.140.0000.00716.91
8.0.130.0030.00313.51
8.0.120.0030.00516.91
8.0.110.0070.00017.00
8.0.100.0000.00717.09
8.0.90.0000.00716.92
8.0.80.0100.00717.08
8.0.70.0050.00216.90
8.0.60.0040.00416.91
8.0.50.0040.00417.11
8.0.30.0050.01417.15
8.0.20.0060.01317.41
8.0.10.0050.00217.05
8.0.00.0120.00716.93
7.4.330.0060.00015.00
7.4.320.0030.00316.70
7.4.300.0040.00416.53
7.4.290.0000.00716.63
7.4.280.0030.00716.64
7.4.270.0040.00416.55
7.4.260.0060.00316.45
7.4.250.0020.00516.60
7.4.240.0040.00416.53
7.4.230.0000.00716.54
7.4.220.0160.01016.76
7.4.210.0070.00716.63
7.4.200.0000.00716.45
7.4.160.0060.01316.73
7.4.150.0090.00917.40
7.4.140.0070.01217.86
7.4.130.0110.01116.48
7.4.120.0100.01016.72
7.4.110.0040.01416.68
7.4.100.0150.00316.63
7.4.90.0070.01016.55
7.4.80.0060.01519.39
7.4.70.0030.01616.70
7.4.60.0130.00916.43
7.4.50.0000.00816.33
7.4.40.0170.00616.68
7.4.30.0120.00416.63
7.4.00.0030.01415.13
7.3.330.0030.00313.27
7.3.320.0000.00513.43
7.3.310.0000.00716.51
7.3.300.0030.00316.36
7.3.290.0100.00316.50
7.3.280.0090.01016.54
7.3.270.0130.00317.40
7.3.260.0130.00416.49
7.3.240.0080.01216.81
7.3.230.0100.00716.49
7.3.210.0120.00716.53
7.3.200.0090.00619.39
7.3.190.0110.01416.41
7.3.180.0150.00716.55
7.3.170.0090.00616.47
7.3.160.0100.01316.50
7.3.10.0100.00616.56
7.3.00.0130.00716.59
7.2.330.0120.01216.71
7.2.320.0040.01416.83
7.2.310.0150.00316.82
7.2.300.0100.00716.66
7.2.290.0100.00816.89
7.2.130.0050.00516.96
7.2.120.0090.00916.59
7.2.110.0110.00716.92
7.2.100.0070.01017.02
7.2.90.0060.00916.70
7.2.80.0070.01116.95
7.2.70.0070.00716.84
7.2.60.0050.00816.93
7.2.50.0070.01116.90
7.2.40.0040.01416.90
7.2.30.0000.01116.68
7.2.20.0030.00917.01
7.2.10.0070.00716.57
7.2.00.0080.00518.19
7.1.250.0030.01315.63
7.1.240.0030.00615.82
7.1.230.0060.00615.96
7.1.220.0050.00515.70
7.1.210.0110.00715.82
7.1.200.0050.01015.71
7.1.190.0060.00315.71
7.1.180.0110.00015.80
7.1.170.0100.00615.99
7.1.160.0030.01015.80
7.1.150.0080.00615.80
7.1.140.0070.00715.59
7.1.130.0100.00015.76
7.1.120.0060.00615.56
7.1.110.0160.00315.70
7.1.100.0050.00617.12
7.1.90.0030.00615.91
7.1.80.0040.00715.83
7.1.70.0070.00316.60
7.1.60.0100.01017.50
7.1.50.0100.01116.29
7.1.40.0060.00915.89
7.1.30.0070.00415.76
7.1.20.0030.00915.66
7.1.10.0070.01115.52
7.1.00.0050.03918.99
7.0.330.0070.01015.47
7.0.320.0030.01015.11
7.0.310.0060.00615.44
7.0.300.0130.01015.30
7.0.290.0070.00715.02
7.0.280.0040.00715.48
7.0.270.0030.00915.27
7.0.260.0030.01415.50
7.0.250.0030.00915.34
7.0.240.0000.01315.50
7.0.230.0060.00915.36
7.0.220.0060.00615.41
7.0.210.0070.00715.05
7.0.200.0030.01016.04
7.0.190.0070.01115.43
7.0.180.0060.00615.38
7.0.170.0060.00615.21
7.0.160.0160.00015.13
7.0.150.0100.00315.42
7.0.140.0050.04118.75
7.0.130.0070.00715.16
7.0.120.0060.00915.33
7.0.110.0090.00315.55
7.0.100.0110.00515.35
7.0.90.0030.01215.48
7.0.80.0050.00515.43
7.0.70.0080.00415.44
7.0.60.0030.02917.53
7.0.50.0080.02816.73
7.0.40.0070.04816.77
7.0.30.0170.03716.74
7.0.20.0170.02916.81
7.0.10.0070.02216.80
7.0.00.0030.03816.74
5.6.380.0100.00613.93
5.6.370.0000.01414.32
5.6.360.0130.00014.14
5.6.350.0030.00814.22
5.6.340.0070.00714.14
5.6.330.0070.01114.64
5.6.320.0080.00814.50
5.6.310.0110.00613.90
5.6.300.0100.00314.28
5.6.290.0070.00714.69
5.6.280.0130.03217.65
5.6.270.0030.01314.10
5.6.260.0060.00614.45
5.6.250.0100.00514.36
5.6.240.0080.00814.34
5.6.230.0070.00713.95
5.6.220.0100.00314.46
5.6.210.0070.03817.36
5.6.200.0100.04016.24
5.6.190.0060.03017.58
5.6.180.0090.02417.27
5.6.170.0180.02317.46
5.6.160.0130.03917.29
5.6.150.0040.04216.25
5.6.140.0070.04516.25
5.6.130.0040.02616.37
5.6.120.0130.04017.67
5.6.110.0100.04717.70
5.6.100.0050.04517.60
5.6.90.0110.04317.51
5.6.80.0070.04217.38
5.6.70.0030.00914.04
5.6.60.0090.00014.41
5.6.50.0070.00414.04
5.6.40.0040.00813.98
5.6.30.0030.01013.95
5.6.20.0030.00914.07
5.6.10.0060.00914.38
5.6.00.0090.00614.34
5.5.380.0040.00710.99
5.5.370.0060.00311.14
5.5.360.0030.00311.17
5.5.350.0150.04015.84
5.5.340.0020.02514.43
5.5.330.0080.03615.84
5.5.320.0220.04015.77
5.5.310.0180.04315.61
5.5.300.0110.03814.50
5.5.290.0090.02814.64
5.5.280.0070.04015.75
5.5.270.0050.03115.90
5.5.260.0070.04115.76
5.5.250.0060.03915.73
5.5.240.0150.04215.70
5.5.230.0060.00810.92
5.5.220.0000.01311.04
5.5.210.0100.00310.94
5.5.200.0070.00310.95
5.5.190.0060.00611.13
5.5.180.0090.00511.40
5.5.170.0000.01311.17
5.5.160.0060.00310.95
5.5.150.0000.00911.17
5.5.140.0040.00410.93
5.5.130.0090.00010.64
5.5.120.0100.00011.44
5.5.110.0000.01411.26
5.5.100.0090.00011.02
5.5.90.0030.00310.72
5.5.80.0070.00311.41
5.5.70.0000.01011.28
5.5.60.0030.01010.89
5.5.50.0050.00211.39
5.5.40.0040.00411.13
5.5.30.0000.01010.86
5.5.20.0040.00411.13
5.5.10.0000.00810.92
5.5.00.0060.00011.20
5.4.450.1470.02415.24
5.4.440.1600.02215.22
5.4.430.1630.02115.14
5.4.420.1630.02115.34
5.4.410.1610.02515.05
5.4.400.1700.03015.15
5.4.390.1600.02515.16
5.4.380.1630.02015.10
5.4.370.1600.02015.14
5.4.360.1590.02615.24
5.4.350.1590.02614.91
5.4.340.1820.01715.16
5.4.330.0070.00711.29
5.4.320.1600.02715.00
5.4.310.1510.02415.10
5.4.300.1720.01815.07
5.4.290.1650.02515.04
5.4.280.1670.02515.01
5.4.270.1850.02415.19
5.4.260.1570.02215.14
5.4.250.1620.02415.10
5.4.240.1320.02215.08
5.4.230.1550.02015.05
5.4.220.1610.02115.11
5.4.210.1620.02015.00
5.4.200.1820.02215.22
5.4.190.1500.02115.17
5.4.180.1570.01814.99
5.4.170.1580.01815.00
5.4.160.1600.02015.11
5.4.150.1500.02415.09
5.4.140.1720.02113.79
5.4.130.1630.01713.79
5.4.120.1630.02113.76
5.4.110.1680.01813.66
5.4.100.1390.02013.76
5.4.90.1380.02113.78
5.4.80.1450.02013.75
5.4.70.1730.02413.75
5.4.60.1620.02113.57
5.4.50.1640.01813.58
5.4.40.1640.01713.74
5.4.30.1110.02113.46
5.4.20.0070.03813.67
5.4.10.0050.02013.88
5.4.00.0040.03213.52
5.3.290.1320.02112.45
5.3.280.1610.02312.43
5.3.270.1480.02112.28
5.3.260.1570.02512.30
5.3.250.1560.02212.39
5.3.240.1650.02312.34
5.3.230.1570.02212.56
5.3.220.1470.02212.42
5.3.210.1620.02012.37
5.3.200.1580.02412.24
5.3.190.1500.02012.43
5.3.180.1600.02012.42
5.3.170.1490.01912.60
5.3.160.1520.01912.43
5.3.150.1670.01712.58
5.3.140.1640.02012.45
5.3.130.1620.02212.47
5.3.120.1550.02312.41
5.3.110.1710.02012.30
5.3.100.1680.01812.28
5.3.90.1500.02512.21
5.3.80.1620.02212.04
5.3.70.1670.02012.15
5.3.60.1570.02412.12
5.3.50.1550.01512.06
5.3.40.1380.02012.01
5.3.30.0010.02512.05
5.3.20.0020.02411.99
5.3.10.0020.02311.88
5.3.00.0780.02211.85
5.2.170.1270.01810.28
5.2.160.1350.01610.39
5.2.150.1280.01810.34
5.2.140.1360.01310.23
5.2.130.1570.01510.31
5.2.120.1320.01710.30
5.2.110.1350.01810.29
5.2.100.1460.01210.21
5.2.90.1230.01510.21
5.2.80.1320.02010.22
5.2.70.1280.01310.31
5.2.60.1300.01910.19
5.2.50.1260.01810.27
5.2.40.1190.01910.26
5.2.30.0980.02010.18
5.2.20.1030.01510.14
5.2.10.1150.02110.12
5.2.00.0900.01810.03
5.1.60.1020.0129.67
5.1.50.1020.0159.74
5.1.40.1000.0129.68
5.1.30.1020.0129.88
5.1.20.0980.0179.86
5.1.10.0980.0179.73
5.1.00.1070.0129.78
5.0.50.0500.0128.97
5.0.40.0530.0108.88
5.0.30.0510.0168.80
5.0.20.0550.0138.84
5.0.10.0600.0108.78
5.0.00.0620.0208.75
4.4.90.0500.0097.83
4.4.80.0530.0117.83
4.4.70.0660.0077.83
4.4.60.0510.0087.83
4.4.50.0570.0117.83
4.4.40.0480.0137.83
4.4.30.0660.0087.83
4.4.20.0610.0107.83
4.4.10.0580.0117.83
4.4.00.0660.0137.83
4.3.110.0610.0087.83
4.3.100.0510.0097.83
4.3.90.0600.0137.83
4.3.80.0640.0127.83
4.3.70.0580.0107.83
4.3.60.0600.0077.83
4.3.50.0580.0087.83
4.3.40.0600.0207.83
4.3.30.0280.0107.83
4.3.20.0370.0127.83
4.3.10.0330.0147.83
4.3.00.0280.0117.83

preferences:
63.77 ms | 400 KiB | 5 Q