3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = ['07511 111111', '+447511 111111', '+44 (0) 7511 111111', '07211 111111', '3749853857', '0712121211233', '00447511 111111']; 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.0100.00616.63
8.3.60.0100.01016.88
8.3.50.0140.00922.08
8.3.40.0090.00919.04
8.3.30.0090.00919.00
8.3.20.0040.00420.39
8.3.10.0000.00823.46
8.3.00.0030.00619.54
8.2.180.0150.00616.75
8.2.170.0000.01422.96
8.2.160.0070.00720.35
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0070.01126.16
8.2.120.0050.00321.11
8.2.110.0060.00322.21
8.2.100.0080.00418.09
8.2.90.0000.00819.22
8.2.80.0040.00418.00
8.2.70.0080.00017.75
8.2.60.0000.01118.03
8.2.50.0060.00318.07
8.2.40.0000.00917.95
8.2.30.0050.00218.36
8.2.20.0000.00817.98
8.2.10.0040.00418.32
8.2.00.0050.00317.88
8.1.280.0000.01425.92
8.1.270.0000.00822.14
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00622.04
8.1.230.0080.00319.19
8.1.220.0030.00517.74
8.1.210.0080.00418.77
8.1.200.0090.00017.35
8.1.190.0060.00317.36
8.1.180.0060.00318.10
8.1.170.0000.00818.72
8.1.160.0080.00021.99
8.1.150.0040.00418.85
8.1.140.0050.00317.62
8.1.130.0000.00717.80
8.1.120.0040.00417.61
8.1.110.0040.00417.56
8.1.100.0000.00717.60
8.1.90.0030.00317.68
8.1.80.0000.00817.65
8.1.70.0000.00817.64
8.1.60.0080.00017.75
8.1.50.0040.00417.73
8.1.40.0040.00417.69
8.1.30.0030.00617.89
8.1.20.0040.00417.77
8.1.10.0050.00317.71
8.1.00.0000.00817.70
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0050.00318.50
8.0.270.0030.00317.21
8.0.260.0000.00617.21
8.0.250.0070.00017.11
8.0.240.0040.00417.15
8.0.230.0030.00317.21
8.0.220.0040.00416.93
8.0.210.0000.00716.96
8.0.200.0030.00317.15
8.0.190.0040.00417.18
8.0.180.0040.00417.12
8.0.170.0000.00816.96
8.0.160.0000.00717.12
8.0.150.0040.00417.01
8.0.140.0040.00417.03
8.0.130.0050.00013.43
8.0.120.0050.00316.91
8.0.110.0040.00416.96
8.0.100.0050.00317.01
8.0.90.0000.00817.11
8.0.80.0080.00817.08
8.0.70.0000.00817.00
8.0.60.0050.00316.94
8.0.50.0000.00717.00
8.0.30.0110.00817.13
8.0.20.0080.01217.49
8.0.10.0000.00717.04
8.0.00.0110.00817.09
7.4.330.0050.00015.07
7.4.320.0070.00016.84
7.4.300.0040.00416.64
7.4.290.0000.00816.73
7.4.280.0000.00716.70
7.4.270.0030.00316.74
7.4.260.0060.00316.75
7.4.250.0030.00616.80
7.4.240.0050.00216.80
7.4.230.0030.00316.93
7.4.220.0070.01016.84
7.4.210.0080.01216.67
7.4.200.0070.00016.68
7.4.160.0190.00616.77
7.4.150.0040.01317.40
7.4.140.0090.00917.86
7.4.130.0090.00916.71
7.4.120.0100.01116.75
7.4.110.0070.01016.71
7.4.100.0110.00616.79
7.4.90.0140.00316.72
7.4.80.0080.01119.39
7.4.70.0070.01016.54
7.4.60.0080.00816.77
7.4.50.0050.00016.63
7.4.40.0100.00716.78
7.4.30.0040.01216.64
7.4.00.0090.00615.37
7.3.330.0030.00313.33
7.3.320.0000.00613.45
7.3.310.0040.00416.45
7.3.300.0070.00016.33
7.3.290.0030.01616.54
7.3.280.0110.00616.49
7.3.270.0110.00717.40
7.3.260.0170.00716.79
7.3.250.0140.00516.62
7.3.240.0090.00916.49
7.3.230.0100.00716.78
7.3.210.0120.00616.46
7.3.200.0040.01819.39
7.3.190.0070.01016.77
7.3.180.0100.00616.67
7.3.170.0060.01016.62
7.3.160.0160.00016.77
7.3.120.0090.00615.19
7.2.330.0130.01016.87
7.2.320.0030.01316.88
7.2.310.0100.00816.89
7.2.300.0130.00316.92
7.2.290.0060.00916.68
7.2.120.0120.00616.75
7.2.110.0040.01116.88
7.2.100.0080.00816.65
7.2.90.0120.00616.98
7.2.80.0120.00316.61
7.2.70.0120.00616.89
7.2.60.0140.00517.23
7.2.50.0100.01017.14
7.2.40.0150.00417.34
7.2.30.0160.00317.07
7.2.20.0180.00317.11
7.2.10.0100.00517.25
7.2.00.0090.00818.39
7.1.240.0130.00315.91
7.1.230.0130.00516.13
7.1.220.0150.00015.98
7.1.210.0130.00316.11
7.1.200.0150.00015.91
7.1.190.0090.00915.61
7.1.180.0100.00715.84
7.1.170.0030.01315.99
7.1.160.0160.00316.13
7.1.150.0110.00415.93
7.1.140.0150.00015.74
7.1.130.0050.01015.61
7.1.120.0030.01015.96
7.1.110.0170.00016.08
7.1.100.0060.00917.27
7.1.90.0150.00315.83
7.1.80.0150.00416.06
7.1.70.0100.00516.68
7.1.60.0060.00817.67
7.1.50.0040.01716.46
7.1.40.0100.00315.70
7.1.30.0170.00415.73
7.1.20.0140.00315.71
7.1.10.0080.00816.02
7.1.00.0030.04119.16
7.0.320.0190.00015.51
7.0.310.0050.01115.48
7.0.300.0040.01215.66
7.0.290.0000.01715.31
7.0.280.0100.00315.58
7.0.270.0090.00915.32
7.0.260.0100.00515.39
7.0.250.0100.00515.69
7.0.240.0110.00815.43
7.0.230.0050.01015.71
7.0.220.0070.00715.67
7.0.210.0120.00415.70
7.0.200.0040.01116.30
7.0.190.0090.00915.75
7.0.180.0130.00415.51
7.0.170.0070.00715.55
7.0.160.0140.00015.74
7.0.150.0100.00315.41
7.0.140.0040.04418.74
7.0.130.0100.00715.42
7.0.120.0120.00315.69
7.0.110.0110.00615.30
7.0.100.0100.00715.55
7.0.90.0090.00515.63
7.0.80.0130.00315.53
7.0.70.0110.00615.49
7.0.60.0090.03617.85
7.0.50.0060.03516.72
7.0.40.0100.04316.96
7.0.30.0220.02316.98
7.0.20.0140.03116.85
7.0.10.0100.04516.88
7.0.00.0100.04017.03
5.6.380.0090.00414.64
5.6.370.0150.00014.10
5.6.360.0100.00714.75
5.6.350.0100.00714.52
5.6.340.0080.00414.39
5.6.330.0080.00814.44
5.6.320.0110.00714.48
5.6.310.0050.01214.43
5.6.300.0120.00314.38
5.6.290.0120.00514.32
5.6.280.0070.04317.65
5.6.270.0100.00514.29
5.6.260.0080.00714.37
5.6.250.0090.00614.32
5.6.240.0140.00014.41
5.6.230.0030.01314.22
5.6.220.0090.00614.23
5.6.210.0120.02117.71
5.6.200.0070.04616.36
5.6.190.0120.03317.56
5.6.180.1760.02117.41
5.6.170.0180.04117.43
5.6.160.0030.03217.47
5.6.150.0030.02216.26
5.6.140.0050.02316.29
5.6.130.0050.03016.34
5.6.120.0090.02517.88
5.6.110.0050.04017.86
5.6.100.0030.03417.62
5.6.90.0080.04517.72
5.6.80.0100.03317.49
5.6.70.1710.01817.51
5.6.60.0030.00614.42
5.6.50.0080.00414.41
5.6.40.0070.00714.36
5.6.30.0100.00314.32
5.6.20.0030.01114.35
5.6.10.0040.00714.59
5.6.00.0060.00614.42
5.5.380.0120.00311.10
5.5.370.0110.00411.50
5.5.360.0060.00611.02
5.5.350.0100.02115.83
5.5.340.0110.03814.67
5.5.330.0030.03315.75
5.5.320.0250.03315.65
5.5.310.0140.02315.75
5.5.300.0120.03714.72
5.5.290.0080.04114.61
5.5.280.0080.03616.02
5.5.270.0020.02616.09
5.5.260.0080.04516.04
5.5.250.0020.04515.98
5.5.240.1800.02715.79
5.5.230.0060.00610.99
5.5.220.0040.00411.30
5.5.210.0030.00511.00
5.5.200.0030.00711.00
5.5.190.0090.00011.36
5.5.180.0070.00311.21
5.5.170.0060.00814.45
5.5.160.0040.00411.25
5.5.150.0040.00810.82
5.5.140.0060.00311.00
5.5.130.0000.00811.38
5.5.120.0050.00311.06
5.5.110.0030.00311.14
5.5.100.0030.00711.24
5.5.90.0000.00810.96
5.5.80.0110.00010.93
5.5.70.0040.00410.95
5.5.60.0000.00611.06
5.5.50.0000.01111.09
5.5.40.0040.00411.16
5.5.30.0000.00511.18
5.5.20.0000.01211.15
5.5.10.0000.00811.07
5.5.00.0040.00411.20
5.4.450.0270.02627.66
5.4.440.0230.02827.50
5.4.430.0130.02727.54
5.4.420.0290.02927.49
5.4.410.0210.02227.54
5.4.400.0070.02527.49
5.4.390.0210.01827.41
5.4.380.0130.02514.90
5.4.370.0050.03014.72
5.4.360.0030.03114.89
5.4.350.0050.03514.79
5.4.340.0180.01814.83
5.4.330.0000.01111.07
5.4.320.0060.02011.84
5.4.310.0040.02311.76
5.4.300.0020.02211.76
5.4.290.0060.02211.83
5.4.280.0060.01911.79
5.4.270.0080.01911.60
5.4.260.0050.02111.65
5.4.250.0050.02311.76
5.4.240.0060.02211.72
5.4.230.0050.02311.82
5.4.220.0050.02211.65
5.4.210.0060.02111.50
5.4.200.0080.01911.79
5.4.190.0050.02811.68
5.4.180.0040.02211.66
5.4.170.0080.02011.72
5.4.160.0040.02111.56
5.4.150.0050.01911.67
5.4.140.0070.02111.55
5.4.130.0070.02111.57
5.4.120.0060.01911.38
5.4.110.0040.01911.54
5.4.100.0070.01811.51
5.4.90.0050.02311.57
5.4.80.0040.02111.56
5.4.70.0070.01911.47
5.4.60.0020.02311.52
5.4.50.0030.02411.49
5.4.40.0060.02111.49
5.4.30.0050.02111.43
5.4.20.0060.02011.46
5.4.10.0060.02011.59
5.4.00.0090.01811.12
5.3.290.0060.02111.56
5.3.280.0080.02011.51
5.3.270.0040.02411.52
5.3.260.0080.02111.51
5.3.250.0040.02411.51
5.3.240.0080.01811.51
5.3.230.0050.02211.51
5.3.220.0070.02111.50
5.3.210.0060.02411.50
5.3.200.0030.02211.50
5.3.190.0020.02311.49
5.3.180.0060.01911.49
5.3.170.0080.01611.50
5.3.160.0030.02111.52
5.3.150.0060.02111.49
5.3.140.0070.01911.49
5.3.130.0040.02611.48
5.3.120.0080.02011.48
5.3.110.0050.02611.48
5.3.100.0070.02111.21
5.3.90.0040.02111.21
5.3.80.0070.01711.19
5.3.70.0070.01911.19
5.3.60.0050.02611.19
5.3.50.0070.02511.15
5.3.40.0070.02711.16
5.3.30.0050.02711.13
5.3.20.0060.02011.02
5.3.10.0060.01911.00
5.3.00.0040.02211.00
5.2.170.0050.0189.75
5.2.160.0050.0169.75
5.2.150.0050.0179.74
5.2.140.0030.0179.74
5.2.130.0030.0179.72
5.2.120.0050.0139.72
5.2.110.0050.0179.73
5.2.100.0020.0219.72
5.2.90.0020.0189.73
5.2.80.0070.0219.72
5.2.70.0040.0179.73
5.2.60.0050.0169.70
5.2.50.0050.0169.68
5.2.40.0040.0179.67
5.2.30.0040.0199.66
5.2.20.0040.0179.66
5.2.10.0020.0189.62
5.2.00.0040.0159.55
5.1.60.0030.0169.19
5.1.50.0040.0169.19
5.1.40.0030.0159.18
5.1.30.0030.0189.35
5.1.20.0030.0179.36
5.1.10.0050.0139.22
5.1.00.0040.0149.22
5.0.50.0060.0108.46
5.0.40.0030.0148.40
5.0.30.0040.0178.30
5.0.20.0040.0118.29
5.0.10.0030.0118.27
5.0.00.0020.0228.27
4.4.90.0040.0087.54
4.4.80.0030.0117.53
4.4.70.0020.0117.53
4.4.60.0020.0117.53
4.4.50.0030.0097.54
4.4.40.0040.0167.51
4.4.30.0010.0127.53
4.4.20.0040.0087.58
4.4.10.0020.0107.58
4.4.00.0030.0147.53
4.3.110.0030.0097.49
4.3.100.0020.0127.49
4.3.90.0010.0117.47
4.3.80.0040.0177.45
4.3.70.0030.0087.47
4.3.60.0020.0097.47
4.3.50.0000.0157.47
4.3.40.0020.0147.42
4.3.30.0030.0136.80
4.3.20.0010.0106.78
4.3.10.0000.0116.77
4.3.00.0030.01027.05

preferences:
54.75 ms | 401 KiB | 5 Q