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; } 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.0110.00618.43
8.3.50.0120.00822.04
8.3.40.0070.01018.73
8.3.30.0000.01419.21
8.3.20.0040.00420.14
8.3.10.0080.00023.61
8.3.00.0030.00919.51
8.2.180.0150.00616.75
8.2.170.0040.01122.96
8.2.160.0110.00420.35
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0000.00822.29
8.2.110.0030.00621.03
8.2.100.0060.00618.03
8.2.90.0040.00418.03
8.2.80.0040.00417.97
8.2.70.0040.00417.63
8.2.60.0030.00517.93
8.2.50.0060.00318.07
8.2.40.0060.00320.01
8.2.30.0040.00418.17
8.2.20.0050.00217.87
8.2.10.0040.00418.19
8.2.00.0030.00617.78
8.1.280.0200.00025.92
8.1.270.0040.00423.88
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00422.46
8.1.230.0080.00420.91
8.1.220.0040.00417.76
8.1.210.0040.00818.98
8.1.200.0100.00017.35
8.1.190.0030.00517.35
8.1.180.0040.00418.10
8.1.170.0080.00018.54
8.1.160.0000.00722.01
8.1.150.0070.00018.80
8.1.140.0020.00517.37
8.1.130.0000.00817.73
8.1.120.0070.00017.46
8.1.110.0040.00417.36
8.1.100.0000.00717.48
8.1.90.0000.00717.54
8.1.80.0000.00817.36
8.1.70.0000.00717.44
8.1.60.0030.00617.50
8.1.50.0080.00017.55
8.1.40.0000.00817.57
8.1.30.0030.00617.64
8.1.20.0050.00217.70
8.1.10.0070.00017.46
8.1.00.0000.00817.41
8.0.300.0000.00819.86
8.0.290.0000.00716.88
8.0.280.0030.00318.36
8.0.270.0040.00417.28
8.0.260.0000.00617.26
8.0.250.0000.00616.94
8.0.240.0000.00617.10
8.0.230.0030.00317.02
8.0.220.0000.00716.90
8.0.210.0030.00316.97
8.0.200.0060.00316.90
8.0.190.0030.00517.02
8.0.180.0000.00716.97
8.0.170.0000.00816.88
8.0.160.0040.00416.88
8.0.150.0040.00416.89
8.0.140.0000.00816.86
8.0.130.0030.00313.40
8.0.120.0040.00416.88
8.0.110.0070.00016.97
8.0.100.0000.00816.87
8.0.90.0030.00316.82
8.0.80.0070.01017.00
8.0.70.0000.01016.96
8.0.60.0000.00916.95
8.0.50.0000.00716.82
8.0.30.0080.01417.25
8.0.20.0100.00717.40
8.0.10.0070.00016.98
8.0.00.0130.00416.64
7.4.330.0030.00315.00
7.4.320.0050.00316.63
7.4.300.0000.00616.57
7.4.290.0030.00316.63
7.4.280.0000.00816.43
7.4.270.0030.00316.64
7.4.260.0030.00316.62
7.4.250.0000.00816.56
7.4.240.0030.00516.56
7.4.230.0040.00416.65
7.4.220.0070.01116.64
7.4.210.0120.00316.45
7.4.200.0040.00416.72
7.4.160.0100.00716.41
7.4.150.0080.01217.40
7.4.140.0140.00917.86
7.4.130.0070.01016.60
7.4.120.0080.01016.54
7.4.110.0140.00416.49
7.4.100.0180.00616.64
7.4.90.0110.00616.43
7.4.80.0060.01519.39
7.4.70.0120.00616.79
7.4.60.0070.01916.53
7.4.50.0030.00616.50
7.4.40.0040.01316.46
7.4.30.0130.00316.81
7.4.00.0030.01215.19
7.3.330.0000.00613.23
7.3.320.0020.00213.46
7.3.310.0040.00416.42
7.3.300.0000.00716.40
7.3.290.0030.01216.47
7.3.280.0100.00616.45
7.3.270.0100.01317.40
7.3.260.0030.01416.44
7.3.250.0140.00616.52
7.3.240.0140.00716.66
7.3.230.0120.00316.45
7.3.210.0040.01416.72
7.3.200.0140.01119.39
7.3.190.0040.01416.64
7.3.180.0130.00416.63
7.3.170.0080.00816.55
7.3.160.0070.01016.69
7.2.330.0060.01216.82
7.2.320.0100.01016.52
7.2.310.0140.00716.46
7.2.300.0150.00416.65
7.2.290.0030.02116.57
7.2.60.0070.00716.59
7.2.00.0000.00919.32
7.1.200.0060.00915.73
7.1.100.0030.01018.25
7.1.70.0080.00017.22
7.1.60.0060.01919.32
7.1.50.0120.01216.70
7.1.00.0070.07322.40
7.0.200.0040.00716.77
7.0.140.0030.07321.95
7.0.60.0070.08320.05
7.0.50.0000.04717.87
7.0.40.0030.07020.27
7.0.30.0100.05020.34
7.0.20.0300.06320.19
7.0.10.0100.06320.06
7.0.00.0070.05020.30
5.6.280.0100.06720.91
5.6.210.0130.07320.53
5.6.200.0030.07718.25
5.6.190.0130.08020.63
5.6.180.0370.05020.50
5.6.170.0130.05720.54
5.6.160.0030.05720.54
5.6.150.0200.06718.18
5.6.140.0070.06718.18
5.6.130.0130.04018.21
5.6.120.0130.03321.16
5.6.110.0030.07321.13
5.6.100.0000.08021.15
5.6.90.0170.07021.02
5.6.80.0030.05320.51
5.5.350.0030.08320.46
5.5.340.0070.05317.96
5.5.330.0100.05720.41
5.5.320.0300.06020.22
5.5.310.0230.08020.29
5.5.300.0030.04318.04
5.5.290.0030.04017.98
5.5.280.0030.05020.79
5.5.270.0070.08320.94
5.5.260.0100.07720.70
5.5.250.0000.05320.70
5.5.240.0030.03720.28
5.4.450.0230.05019.48
5.4.440.0270.06719.47
5.4.430.0130.06019.46
5.4.420.0670.00019.37
5.4.410.0630.00019.26
5.4.400.0600.00019.27
5.4.390.0630.00019.27
5.4.380.0630.00019.13
5.4.370.0630.00019.03
5.4.360.0700.00019.16
5.4.350.0630.00019.12
5.4.340.0060.03412.04
5.4.320.0050.03612.53
5.4.310.0070.03712.52
5.4.300.0080.03412.53
5.4.290.0070.03512.52
5.4.280.0090.03812.42
5.4.270.0050.04112.42
5.4.260.0090.04512.42
5.4.250.0060.04212.42
5.4.240.0070.04112.42
5.4.230.0070.03912.42
5.4.220.0110.04412.41
5.4.210.0070.03812.42
5.4.200.0040.04912.41
5.4.190.0050.04612.41
5.4.180.0080.03612.41
5.4.170.0090.03312.41
5.4.160.0080.03312.41
5.4.150.0090.03312.41
5.4.140.0040.04012.09
5.4.130.0030.03912.08
5.4.120.0090.03212.04
5.4.110.0070.03412.04
5.4.100.0080.03412.04
5.4.90.0060.04112.04
5.4.80.0070.03912.04
5.4.70.0040.03912.03
5.4.60.0040.03812.03
5.4.50.0040.03812.04
5.4.40.0050.03712.02
5.4.30.0060.04212.02
5.4.20.0060.03612.02
5.4.10.0040.03812.02
5.4.00.0060.04111.51
5.3.290.0060.04412.80
5.3.280.0100.03312.71
5.3.270.0060.04112.72
5.3.260.0060.04012.72
5.3.250.0070.04012.72
5.3.240.0080.03512.72
5.3.230.0090.03812.71
5.3.220.0090.03312.68
5.3.210.0060.04112.68
5.3.200.0050.03812.68
5.3.190.0060.03812.68
5.3.180.0060.03912.68
5.3.170.0080.05212.67
5.3.160.0060.03912.67
5.3.150.0070.04012.68
5.3.140.0070.03512.66
5.3.130.0060.04112.66
5.3.120.0070.03812.66
5.3.110.0050.03912.65
5.3.100.0080.03512.13
5.3.90.0050.03712.11
5.3.80.0040.03812.09
5.3.70.0070.03612.09
5.3.60.0060.03812.08
5.3.50.0050.03812.02
5.3.40.0050.03812.02
5.3.30.0060.03411.98
5.3.20.0080.03411.77
5.3.10.0050.03611.74
5.3.00.0070.03611.71
5.2.170.0040.0319.22
5.2.160.0040.0339.22
5.2.150.0060.0319.22
5.2.140.0040.0319.21
5.2.130.0070.0359.18
5.2.120.0070.0269.18
5.2.110.0040.0299.18
5.2.100.0060.0269.18
5.2.90.0050.0309.18
5.2.80.0080.0269.18
5.2.70.0050.0299.17
5.2.60.0040.0309.13
5.2.50.0040.0309.10
5.2.40.0010.0329.07
5.2.30.0060.0289.05
5.2.20.0060.0279.04
5.2.10.0030.0298.95
5.2.00.0040.0308.80
5.1.60.0050.0238.09
5.1.50.0030.0278.09
5.1.40.0060.0228.06
5.1.30.0060.0258.42
5.1.20.0050.0268.44
5.1.10.0050.0258.16
5.1.00.0040.0268.16
5.0.50.0040.0206.64
5.0.40.0030.0236.50
5.0.30.0050.0406.32
5.0.20.0040.0216.29
5.0.10.0030.0206.27
5.0.00.0020.0336.25
4.4.90.0030.0154.78
4.4.80.0020.0164.75
4.4.70.0020.0164.76
4.4.60.0040.0144.76
4.4.50.0010.0164.77
4.4.40.0030.0264.71
4.4.30.0020.0164.76
4.4.20.0030.0164.84
4.4.10.0020.0164.85
4.4.00.0020.0254.75
4.3.110.0030.0154.67
4.3.100.0030.0144.67
4.3.90.0050.0124.63
4.3.80.0010.0254.58
4.3.70.0040.0134.63
4.3.60.0000.0184.63
4.3.50.0020.0164.63
4.3.40.0010.0244.54
4.3.30.0020.0153.30
4.3.20.0020.0153.28
4.3.10.0010.0163.24
4.3.00.0030.0237.61

preferences:
42.49 ms | 401 KiB | 5 Q