3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = ['07511 111111', '+447511 111111', '+44 (0) 7511 111111', '07211 111111', '3749853857', '0712121211233', 'abcd', '0746877774']; 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.70.0070.01016.63
8.3.60.0170.00316.63
8.3.50.0080.01022.09
8.3.40.0080.00819.09
8.3.30.0100.00319.09
8.3.20.0040.00420.20
8.3.10.0080.00023.39
8.3.00.0040.00419.56
8.2.180.0160.00018.42
8.2.170.0110.00422.96
8.2.160.0140.00320.43
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0050.00326.16
8.2.120.0000.00721.04
8.2.110.0090.00022.25
8.2.100.0000.01218.16
8.2.90.0000.00919.30
8.2.80.0000.00917.97
8.2.70.0060.00317.88
8.2.60.0050.00318.04
8.2.50.0080.00018.07
8.2.40.0040.00418.34
8.2.30.0000.00818.24
8.2.20.0050.00217.95
8.2.10.0050.00218.36
8.2.00.0000.00817.94
8.1.280.0100.00325.92
8.1.270.0030.00523.83
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0060.00321.91
8.1.230.0070.00318.97
8.1.220.0000.00817.76
8.1.210.0040.00418.77
8.1.200.0040.00817.47
8.1.190.0000.00817.48
8.1.180.0080.00018.10
8.1.170.0030.00618.83
8.1.160.0030.00622.03
8.1.150.0040.00418.72
8.1.140.0000.00817.57
8.1.130.0040.00417.82
8.1.120.0000.00717.66
8.1.110.0040.00417.65
8.1.100.0030.00517.57
8.1.90.0000.00817.66
8.1.80.0000.00717.68
8.1.70.0030.00317.55
8.1.60.0040.00417.66
8.1.50.0030.00517.59
8.1.40.0000.00817.60
8.1.30.0000.00817.82
8.1.20.0030.00617.81
8.1.10.0040.00417.79
8.1.00.0060.00317.57
8.0.300.0050.00218.77
8.0.290.0000.00816.88
8.0.280.0050.00318.54
8.0.270.0040.00517.23
8.0.260.0000.00617.32
8.0.250.0030.00317.14
8.0.240.0030.00317.17
8.0.230.0000.01017.17
8.0.220.0040.00417.10
8.0.210.0080.00017.09
8.0.200.0000.00617.11
8.0.190.0080.00317.13
8.0.180.0060.00316.98
8.0.170.0000.00917.07
8.0.160.0040.00417.13
8.0.150.0000.00717.00
8.0.140.0040.00416.98
8.0.130.0060.00013.46
8.0.120.0040.00416.96
8.0.110.0040.00417.03
8.0.100.0000.00717.08
8.0.90.0040.00417.02
8.0.80.0090.00917.07
8.0.70.0000.00716.90
8.0.60.0040.00416.87
8.0.50.0040.00417.06
8.0.30.0140.00517.26
8.0.20.0060.01217.41
8.0.10.0040.00417.22
8.0.00.0120.00616.82
7.4.330.0060.00015.09
7.4.320.0000.00716.79
7.4.300.0030.00316.74
7.4.290.0080.00016.67
7.4.280.0040.00416.58
7.4.270.0030.00316.73
7.4.260.0000.01016.84
7.4.250.0040.00416.70
7.4.240.0020.00516.78
7.4.230.0000.00716.94
7.4.220.0070.02016.77
7.4.210.0140.00716.88
7.4.200.0070.00016.72
7.4.160.0060.01016.82
7.4.150.0120.00617.40
7.4.140.0030.01317.86
7.4.130.0080.00916.71
7.4.120.0130.00616.80
7.4.110.0100.00616.68
7.4.100.0060.01516.61
7.4.90.0150.00316.78
7.4.80.0110.00619.39
7.4.70.0100.00616.76
7.4.60.0180.00016.79
7.4.50.0030.00316.58
7.4.40.0100.00616.71
7.4.30.0160.00016.63
7.4.00.0050.01115.21
7.3.330.0000.00613.41
7.3.320.0030.00313.23
7.3.310.0000.00716.57
7.3.300.0000.00716.49
7.3.290.0070.00716.48
7.3.280.0060.01316.48
7.3.270.0060.01317.40
7.3.260.0120.01216.52
7.3.250.0110.00816.64
7.3.240.0160.00016.58
7.3.230.0070.01016.50
7.3.210.0130.00316.77
7.3.200.0100.01319.39
7.3.190.0070.01016.73
7.3.180.0110.00416.43
7.3.170.0060.01016.65
7.3.160.0040.01216.56
7.3.120.0070.01114.97
7.3.110.0110.00414.94
7.3.100.0070.01015.09
7.3.90.0100.00714.80
7.3.80.0080.00815.03
7.3.70.0030.00714.85
7.3.60.0040.00414.91
7.3.50.0070.00714.68
7.3.40.0040.00414.87
7.3.30.0110.00415.01
7.3.20.0070.01016.67
7.3.10.0090.00316.48
7.3.00.0070.00716.88
7.2.330.0080.00916.75
7.2.320.0130.01016.84
7.2.310.0080.00816.94
7.2.300.0160.00616.89
7.2.290.0070.01016.81
7.2.250.0070.01415.25
7.2.240.0060.01315.30
7.2.230.0060.01314.87
7.2.220.0100.00015.44
7.2.210.0110.00415.02
7.2.200.0100.00015.44
7.2.190.0000.01014.86
7.2.180.0000.01215.15
7.2.170.0090.00615.14
7.2.80.0200.01016.37
7.2.60.0070.00717.25
7.2.00.0060.00919.67
7.1.330.0070.00715.81
7.1.320.0030.00615.95
7.1.310.0100.00315.97
7.1.300.0100.00315.71
7.1.290.0040.00816.01
7.1.280.0060.00615.88
7.1.270.0100.00315.84
7.1.260.0000.01316.26
7.1.200.0040.01216.15
7.1.100.0740.00316.26
7.1.70.0030.00717.11
7.1.60.0070.01719.70
7.1.50.0130.01016.92
7.1.00.0030.07022.37
7.0.200.0070.00416.95
7.0.140.0030.07022.08
7.0.60.0000.04319.98
7.0.50.0130.06017.88
7.0.40.0000.06020.10
7.0.30.0200.04020.14
7.0.20.0270.07320.19
7.0.10.0170.08020.03
7.0.00.0100.05720.18
5.6.280.0030.07321.13
5.6.210.0100.05020.62
5.6.200.0070.04718.22
5.6.190.0130.05020.43
5.6.180.2630.04020.67
5.6.170.0270.07720.50
5.6.160.0100.08020.52
5.6.150.0130.07318.14
5.6.140.0100.06018.21
5.6.130.0100.04718.07
5.6.120.0070.05021.11
5.6.110.0070.04020.97
5.6.100.0100.07020.97
5.6.90.0030.09020.96
5.6.80.0070.08020.49
5.6.70.4070.04020.36
5.5.350.0100.07720.43
5.5.340.0330.04017.95
5.5.330.0070.03720.57
5.5.320.0330.07320.29
5.5.310.0300.07020.41
5.5.300.0030.05717.94
5.5.290.0130.07018.02
5.5.280.0100.06320.96
5.5.270.0070.04020.64
5.5.260.0170.07720.65
5.5.250.0100.07720.59
5.5.240.0200.05320.26
5.4.450.1000.05719.54
5.4.440.0400.04743.92
5.4.430.0330.04743.91
5.4.420.0200.04743.90
5.4.410.0400.03343.90
5.4.400.0400.03343.88
5.4.390.0200.04043.86
5.4.380.0100.05718.62
5.4.370.0170.05018.59
5.4.360.0200.04318.59
5.4.350.0100.05318.57
5.4.340.0100.05718.57
5.4.320.0070.03412.46
5.4.310.0080.03612.45
5.4.300.0040.03912.46
5.4.290.0050.03912.45
5.4.280.0070.03512.35
5.4.270.0040.03812.35
5.4.260.0100.03312.35
5.4.250.0040.03812.35
5.4.240.0080.03512.35
5.4.230.0060.04312.34
5.4.220.0050.03912.34
5.4.210.0050.03712.34
5.4.200.0030.04212.34
5.4.190.0070.03412.34
5.4.180.0120.03612.34
5.4.170.0050.03712.35
5.4.160.0050.03612.34
5.4.150.0030.03912.34
5.4.140.0060.03712.03
5.4.130.0060.03912.01
5.4.120.0110.03511.97
5.4.110.0070.03711.97
5.4.100.0050.03911.97
5.4.90.0030.04111.97
5.4.80.0060.03711.96
5.4.70.0050.03611.96
5.4.60.0070.03411.97
5.4.50.0070.03811.96
5.4.40.0060.03411.95
5.4.30.0030.03911.95
5.4.20.0050.03511.95
5.4.10.0050.03511.95
5.4.00.0040.03711.44
5.3.290.0080.04012.80
5.3.280.0090.03812.71
5.3.270.0050.04112.72
5.3.260.0070.03812.72
5.3.250.0060.03912.72
5.3.240.0040.04012.72
5.3.230.0100.03412.71
5.3.220.0040.04012.68
5.3.210.0020.04412.68
5.3.200.0070.03512.68
5.3.190.0080.03812.68
5.3.180.0080.03412.67
5.3.170.0030.03912.67
5.3.160.0030.04012.68
5.3.150.0040.03812.67
5.3.140.0060.03512.66
5.3.130.0030.04812.65
5.3.120.0080.03612.66
5.3.110.0050.03912.66
5.3.100.0060.03712.12
5.3.90.0060.04312.08
5.3.80.0050.04012.07
5.3.70.0070.03512.07
5.3.60.0070.03512.06
5.3.50.0060.04312.00
5.3.40.0050.03912.00
5.3.30.0050.04011.95
5.3.20.0080.03811.72
5.3.10.0090.03611.70
5.3.00.0070.03911.68
5.2.170.0040.0309.18
5.2.160.0060.0319.18
5.2.150.0050.0309.18
5.2.140.0050.0309.18
5.2.130.0050.0299.14
5.2.120.0050.0289.14
5.2.110.0060.0289.14
5.2.100.0040.0309.14
5.2.90.0040.0329.14
5.2.80.0060.0289.14
5.2.70.0060.0339.14
5.2.60.0050.0319.09
5.2.50.0050.0299.06
5.2.40.0030.0319.03
5.2.30.0030.0319.02
5.2.20.0050.0289.00
5.2.10.0070.0258.93
5.2.00.0080.0258.78
5.1.60.0070.0288.06
5.1.50.0030.0268.06
5.1.40.0040.0248.04
5.1.30.0050.0278.39
5.1.20.0050.0268.42
5.1.10.0050.0318.14
5.1.00.0040.0268.14
5.0.50.0060.0216.62
5.0.40.0040.0196.48
5.0.30.0050.0306.29
5.0.20.0020.0216.27
5.0.10.0050.0236.24
5.0.00.0020.0336.23
4.4.90.0010.0174.77
4.4.80.0030.0154.75
4.4.70.0010.0174.75
4.4.60.0020.0164.75
4.4.50.0020.0164.77
4.4.40.0030.0244.71
4.4.30.0030.0154.76
4.4.20.0030.0154.84
4.4.10.0050.0144.85
4.4.00.0040.0244.76
4.3.110.0020.0174.67
4.3.100.0000.0184.66
4.3.90.0040.0144.63
4.3.80.0020.0254.58
4.3.70.0020.0154.63
4.3.60.0040.0134.63
4.3.50.0020.0164.63
4.3.40.0030.0244.53
4.3.30.0000.0183.29
4.3.20.0020.0163.26
4.3.10.0020.0153.22
4.3.00.0070.01343.83

preferences:
41.42 ms | 401 KiB | 5 Q