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 = "усский алфавит"; $tmp = ' '; while ($tmp != $msg) { $tmp = stripNonValidCharaters($msg); $msg = $tmp['message']; } var_dump($msg); /*for($i = 0; $i < strlen($msg); $i++) { 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.40.0000.01418.52
8.3.30.0040.01118.98
8.3.20.0040.00420.20
8.3.10.0000.00723.65
8.3.00.0000.01119.38
8.2.170.0000.01422.96
8.2.160.0030.01020.41
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0030.00526.16
8.2.120.0070.00022.11
8.2.110.0110.00721.17
8.2.100.0090.00317.84
8.2.90.0000.00817.77
8.2.80.0080.00017.97
8.2.70.0060.00317.63
8.2.60.0090.00018.04
8.2.50.0060.00318.07
8.2.40.0000.00820.01
8.2.30.0040.00418.01
8.2.20.0000.00717.82
8.2.10.0000.00818.18
8.2.00.0000.00717.72
8.1.270.0050.00323.83
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0100.00022.34
8.1.230.0070.00421.02
8.1.220.0000.00817.74
8.1.210.0050.00519.04
8.1.200.0030.00617.48
8.1.190.0050.00317.23
8.1.180.0040.00418.10
8.1.170.0040.00418.64
8.1.160.0050.00221.94
8.1.150.0000.00718.89
8.1.140.0000.00717.51
8.1.130.0000.00717.80
8.1.120.0050.00217.48
8.1.110.0030.00417.33
8.1.100.0070.00017.45
8.1.90.0070.00017.50
8.1.80.0000.00717.48
8.1.70.0000.00717.41
8.1.60.0030.00617.52
8.1.50.0000.00817.42
8.1.40.0060.00317.41
8.1.30.0080.00017.70
8.1.20.0030.00617.63
8.1.10.0040.00417.57
8.1.00.0040.00417.52
8.0.300.0040.00419.98
8.0.290.0000.00816.88
8.0.280.0000.00718.37
8.0.270.0030.00316.90
8.0.260.0000.00818.33
8.0.250.0030.00317.07
8.0.240.0000.00717.01
8.0.230.0040.00417.05
8.0.220.0000.00716.96
8.0.210.0030.00316.95
8.0.200.0060.00316.95
8.0.190.0040.00416.94
8.0.180.0070.00016.88
8.0.170.0000.00916.84
8.0.160.0050.00317.02
8.0.150.0000.00716.91
8.0.140.0000.00916.93
8.0.130.0030.00313.42
8.0.120.0040.00416.98
8.0.110.0040.00416.93
8.0.100.0040.00417.02
8.0.90.0050.00316.96
8.0.80.0100.00716.87
8.0.70.0050.00217.03
8.0.60.0070.00016.90
8.0.50.0000.00817.02
8.0.30.0110.00917.04
8.0.20.0100.01017.40
8.0.10.0050.00317.10
8.0.00.0120.00516.85
7.4.330.0060.00015.04
7.4.320.0050.00316.37
7.4.300.0040.00416.43
7.4.290.0040.00416.55
7.4.280.0030.00616.49
7.4.270.0050.00316.39
7.4.260.0060.00316.34
7.4.250.0000.00916.39
7.4.240.0050.00516.51
7.4.230.0050.00316.60
7.4.220.0120.01516.44
7.4.210.0120.01916.45
7.4.200.0000.00816.57
7.4.160.0340.02416.58
7.4.150.0430.01717.40
7.4.140.0210.01117.86
7.4.130.0170.01916.45
7.4.120.0090.02116.56
7.4.110.0270.02516.36
7.4.100.0370.01816.46
7.4.90.0380.01216.38
7.4.80.0080.01719.39
7.4.70.0490.00916.52
7.4.60.1020.04816.53
7.4.50.0060.00616.61
7.4.40.0230.02216.39
7.4.30.0360.00216.70
7.4.00.0070.00714.96
7.3.330.0000.00713.29
7.3.320.0040.00413.25
7.3.310.0040.00416.35
7.3.300.0000.00816.25
7.3.290.0040.01716.34
7.3.280.0110.01516.35
7.3.270.0390.01517.40
7.3.260.0350.02216.52
7.3.250.0350.01516.43
7.3.240.0210.01216.25
7.3.230.0130.01316.39
7.3.210.0240.02016.35
7.3.200.1010.02919.39
7.3.190.0260.02016.58
7.3.180.0410.00916.34
7.3.170.0090.00916.39
7.3.160.0610.04016.43
7.2.330.0140.02116.58
7.2.320.1090.03116.82
7.2.310.0510.02116.56
7.2.300.0710.00616.39
7.2.290.0130.02016.56
7.2.60.0040.01516.86
7.2.00.0040.01419.50
7.1.200.0110.00715.75
7.1.100.0030.00917.98
7.1.70.0040.00417.13
7.1.60.0130.01319.32
7.1.50.0100.01716.84
7.0.200.0070.01316.91

preferences:
41.2 ms | 400 KiB | 5 Q