3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = ['07511 111111', '+447511 111111', '+44 (0) 7511 111111', '07211 111111', '3749853857', '0712121211233', 'abcd']; foreach ($test as $input) { //step 1 - reduce it to digits: preg_match_all('([\+]{0,1}[^\(\) ][0-9]+)', $input, $digits); $digits = implode($digits[0]); //now for step 2.. start by removing +44 and replacing it with 0 if (substr($digits, 0, 3) == '+44') { $digits = str_replace('+44', '0', $digits); } //by this point we should have just a UK-style number, but we must validate it: if ((substr($digits, 2, 1) > 3) && strlen($digits) == 11) { //valid UK mobile number! echo "\nValid UK mobile number $digits"; } }

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.01316.75
8.3.50.0100.01022.11
8.3.40.0090.00618.86
8.3.30.0140.00319.02
8.3.20.0070.00020.31
8.3.10.0040.00423.70
8.3.00.0050.00319.69
8.2.180.0110.01116.86
8.2.170.0090.00622.96
8.2.160.0140.00020.32
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0140.00426.16
8.2.120.0070.00320.94
8.2.110.0100.00022.26
8.2.100.0080.00318.02
8.2.90.0070.00318.00
8.2.80.0060.00317.97
8.2.70.0000.00817.93
8.2.60.0000.00918.05
8.2.50.0060.00318.10
8.2.40.0000.00820.45
8.2.30.0040.00418.24
8.2.20.0000.00717.94
8.2.10.0070.00018.12
8.2.00.0040.00418.03
8.1.280.0000.01425.92
8.1.270.0040.00422.26
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0090.00022.06
8.1.230.0070.00319.10
8.1.220.0050.00317.78
8.1.210.0030.00618.77
8.1.200.0030.00717.35
8.1.190.0080.00017.25
8.1.180.0000.00818.10
8.1.170.0060.00318.96
8.1.160.0030.00621.98
8.1.150.0050.00318.70
8.1.140.0080.00017.73
8.1.130.0000.00717.88
8.1.120.0040.00417.65
8.1.110.0040.00417.53
8.1.100.0000.00717.70
8.1.90.0050.00317.60
8.1.80.0040.00417.68
8.1.70.0030.00317.61
8.1.60.0030.00617.73
8.1.50.0000.00917.59
8.1.40.0040.00417.70
8.1.30.0040.00417.73
8.1.20.0000.00817.75
8.1.10.0000.00817.79
8.1.00.0000.00817.76
8.0.300.0040.00419.62
8.0.290.0070.00016.88
8.0.280.0030.00318.56
8.0.270.0040.00417.35
8.0.260.0040.00418.37
8.0.250.0000.00717.02
8.0.240.0000.00717.11
8.0.230.0000.00717.10
8.0.220.0080.00016.97
8.0.210.0070.00017.06
8.0.200.0000.00617.10
8.0.190.0000.00817.02
8.0.180.0030.00317.08
8.0.170.0030.00617.01
8.0.160.0040.00417.13
8.0.150.0050.00217.03
8.0.140.0050.00217.06
8.0.130.0000.00613.46
8.0.120.0050.00316.91
8.0.110.0040.00417.13
8.0.100.0000.00817.08
8.0.90.0050.00217.11
8.0.80.0200.00017.11
8.0.70.0040.00416.94
8.0.60.0040.00416.92
8.0.50.0000.00816.92
8.0.30.0110.01117.27
8.0.20.0090.00917.40
8.0.10.0050.00317.05
8.0.00.0150.00616.86
7.4.330.0030.00315.04
7.4.320.0030.00316.84
7.4.300.0030.00316.84
7.4.290.0070.00016.75
7.4.280.0030.00316.65
7.4.270.0050.00216.73
7.4.260.0030.00316.85
7.4.250.0040.00416.73
7.4.240.0030.00516.74
7.4.230.0030.00316.77
7.4.220.0060.01216.74
7.4.210.0070.00716.78
7.4.200.0030.00516.91
7.4.160.0110.00716.71
7.4.150.0070.01017.40
7.4.140.0090.00717.86
7.4.130.0020.01416.83
7.4.120.0080.01016.74
7.4.110.0060.01016.59
7.4.100.0090.00716.80
7.4.90.0070.01016.63
7.4.80.0100.01119.39
7.4.70.0130.00316.56
7.4.60.0090.00916.80
7.4.50.0040.00416.66
7.4.40.0120.00616.72
7.4.30.0000.01616.76
7.4.00.0130.00314.98
7.3.330.0050.00013.37
7.3.320.0000.00613.32
7.3.310.0030.00316.45
7.3.300.0080.00016.50
7.3.290.0120.00616.54
7.3.280.0090.01216.53
7.3.270.0180.00017.40
7.3.260.0130.01016.72
7.3.250.0080.01416.80
7.3.240.0060.01716.75
7.3.230.0080.00816.59
7.3.210.0070.01016.82
7.3.200.0110.01119.39
7.3.190.0130.00816.39
7.3.180.0100.00716.51
7.3.170.0040.01216.73
7.3.160.0060.00916.71
7.3.120.0080.00414.93
7.3.10.0070.00716.85
7.3.00.0030.00616.73
7.2.330.0030.01416.81
7.2.320.0060.01316.83
7.2.310.0050.01316.69
7.2.300.0120.00916.71
7.2.290.0040.01416.81
7.2.130.0130.00317.22
7.2.120.0030.00717.14
7.2.110.0060.00917.06
7.2.100.0070.00717.27
7.2.90.0070.01117.01
7.2.80.0080.00817.04
7.2.70.0070.01017.17
7.2.60.0030.01017.18
7.2.50.0000.01717.09
7.2.40.0070.00717.34
7.2.30.0000.01017.36
7.2.20.0060.01316.80
7.2.10.0030.01417.33
7.2.00.0090.01118.60
7.1.250.0080.00415.98
7.1.100.0080.00418.29
7.1.70.0060.00917.33
7.1.60.0030.01719.70
7.1.50.0060.01016.85
7.1.00.0070.07322.30
7.0.200.0040.00416.93
7.0.140.0070.07021.95
7.0.60.0030.08319.94
7.0.50.0070.03717.86
7.0.40.0030.04020.14
7.0.30.0170.05720.14
7.0.20.0330.07320.23
7.0.10.0300.09320.18
7.0.00.0100.04720.17
5.6.280.0030.07320.77
5.6.210.0130.04320.69
5.6.200.0070.03718.19
5.6.190.0030.06020.56
5.6.180.0000.08320.45
5.6.170.0270.05320.53
5.6.160.0070.08320.52
5.6.150.0130.07318.09
5.6.140.0030.04318.09
5.6.130.0030.05318.18
5.6.120.0070.04321.03
5.6.110.0070.05320.86
5.6.100.0130.08021.00
5.6.90.0100.05721.12
5.6.80.0070.03720.37
5.6.70.5030.03720.39
5.5.350.0030.08020.44
5.5.340.0100.08317.91
5.5.330.0000.04720.40
5.5.320.0030.08320.13
5.5.310.0270.06720.29
5.5.300.0070.04018.04
5.5.290.0100.07018.02
5.5.280.0100.07320.95
5.5.270.0070.08320.97
5.5.260.0000.08320.72
5.5.250.0030.08720.68
5.5.240.0070.07020.13
5.4.450.0300.05043.99
5.4.440.0270.04743.92
5.4.430.0370.05043.90
5.4.420.0330.03343.90
5.4.410.0400.04743.89
5.4.400.0230.03343.86
5.4.390.0200.04743.81
5.4.380.0130.05018.69
5.4.370.0100.05718.56
5.4.360.0170.04718.47
5.4.350.0070.06018.45
5.4.340.0100.05718.71
5.4.320.0060.03612.45
5.4.310.0050.03712.45
5.4.300.0040.04012.46
5.4.290.0070.04012.45
5.4.280.0030.03912.35
5.4.270.0060.03512.35
5.4.260.0070.04212.35
5.4.250.0060.04212.35
5.4.240.0090.03612.35
5.4.230.0080.04012.34
5.4.220.0030.03912.34
5.4.210.0110.03512.34
5.4.200.0070.03612.34
5.4.190.0030.03912.34
5.4.180.0080.03412.34
5.4.170.0060.04312.35
5.4.160.0060.04312.34
5.4.150.0070.03412.34
5.4.140.0080.03412.03
5.4.130.0060.03712.01
5.4.120.0060.03411.97
5.4.110.0050.03611.97
5.4.100.0040.03711.97
5.4.90.0060.03611.97
5.4.80.0040.04211.97
5.4.70.0040.03611.96
5.4.60.0050.03611.97
5.4.50.0100.03511.96
5.4.40.0030.03711.95
5.4.30.0110.03711.95
5.4.20.0060.04011.95
5.4.10.0030.03611.95
5.4.00.0070.03511.44
5.3.290.0050.03912.80
5.3.280.0090.03612.70
5.3.270.0090.03712.72
5.3.260.0080.03712.72
5.3.250.0060.04212.72
5.3.240.0040.03912.72
5.3.230.0070.04212.70
5.3.220.0040.03912.68
5.3.210.0060.03912.68
5.3.200.0100.03912.68
5.3.190.0080.03512.68
5.3.180.0030.03812.68
5.3.170.0100.04812.67
5.3.160.0050.03712.68
5.3.150.0060.03712.67
5.3.140.0060.03512.66
5.3.130.0070.03612.66
5.3.120.0030.04112.66
5.3.110.0060.03812.66
5.3.100.0120.03212.12
5.3.90.0040.04112.08
5.3.80.0050.03612.07
5.3.70.0050.03812.07
5.3.60.0050.03612.06
5.3.50.0070.03512.00
5.3.40.0060.03612.00
5.3.30.0110.03311.95
5.3.20.0040.04011.73
5.3.10.0090.03711.70
5.3.00.0030.03911.68
5.2.170.0040.0309.18
5.2.160.0070.0269.18
5.2.150.0030.0329.18
5.2.140.0010.0339.18
5.2.130.0070.0329.14
5.2.120.0050.0289.14
5.2.110.0040.0309.15
5.2.100.0040.0339.14
5.2.90.0050.0339.14
5.2.80.0060.0299.14
5.2.70.0060.0289.14
5.2.60.0040.0309.09
5.2.50.0040.0339.05
5.2.40.0070.0429.03
5.2.30.0040.0299.01
5.2.20.0060.0339.00
5.2.10.0050.0278.93
5.2.00.0040.0328.78
5.1.60.0040.0238.06
5.1.50.0040.0248.06
5.1.40.0060.0228.05
5.1.30.0040.0318.40
5.1.20.0050.0308.42
5.1.10.0070.0238.14
5.1.00.0060.0258.14
5.0.50.0080.0216.62
5.0.40.0020.0216.48
5.0.30.0030.0336.30
5.0.20.0030.0206.26
5.0.10.0050.0186.24
5.0.00.0050.0296.23
4.4.90.0040.0214.77
4.4.80.0020.0174.75
4.4.70.0010.0174.75
4.4.60.0050.0134.75
4.4.50.0030.0154.77
4.4.40.0030.0254.71
4.4.30.0040.0144.76
4.4.20.0020.0164.85
4.4.10.0020.0164.84
4.4.00.0020.0274.76
4.3.110.0040.0204.67
4.3.100.0010.0214.66
4.3.90.0040.0124.64
4.3.80.0040.0304.59
4.3.70.0010.0154.63
4.3.60.0020.0154.62
4.3.50.0050.0184.63
4.3.40.0020.0244.54
4.3.30.0040.0143.28
4.3.20.0030.0143.26
4.3.10.0040.0193.22
4.3.00.0030.01743.79

preferences:
52.44 ms | 401 KiB | 5 Q