3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = ['07511 111111', '+447511 111111', '+44 (0) 7511 111111', '07211 111111', '3749853857', '0712121211233']; 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.0110.00816.63
8.3.50.0140.00422.06
8.3.40.0110.00418.95
8.3.30.0070.00719.09
8.3.20.0000.00820.16
8.3.10.0050.00323.70
8.3.00.0050.00319.78
8.2.180.0160.00018.52
8.2.170.0110.00422.96
8.2.160.0100.00720.44
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0140.00420.89
8.2.110.0080.00022.21
8.2.100.0040.00818.22
8.2.90.0040.00419.34
8.2.80.0040.00417.97
8.2.70.0040.00417.63
8.2.60.0090.00017.91
8.2.50.0030.00618.07
8.2.40.0060.00318.22
8.2.30.0040.00418.25
8.2.20.0060.00317.80
8.2.10.0040.00418.28
8.2.00.0000.00717.96
8.1.280.0170.00025.92
8.1.270.0060.00322.18
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00322.18
8.1.230.0060.00619.09
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0090.00017.36
8.1.190.0000.00817.47
8.1.180.0050.00318.10
8.1.170.0050.00318.78
8.1.160.0000.00822.05
8.1.150.0040.00418.80
8.1.140.0000.00717.64
8.1.130.0030.00317.93
8.1.120.0080.00017.66
8.1.110.0040.00417.65
8.1.100.0040.00417.50
8.1.90.0030.00317.57
8.1.80.0030.00517.63
8.1.70.0030.00317.65
8.1.60.0000.00917.71
8.1.50.0000.00817.63
8.1.40.0000.00817.71
8.1.30.0040.00417.76
8.1.20.0050.00317.70
8.1.10.0000.00717.66
8.1.00.0050.00317.54
8.0.300.0040.00418.77
8.0.290.0070.00016.88
8.0.280.0000.00718.41
8.0.270.0000.00717.18
8.0.260.0070.00017.29
8.0.250.0000.00717.04
8.0.240.0040.00417.03
8.0.230.0030.00317.08
8.0.220.0040.00417.05
8.0.210.0040.00317.00
8.0.200.0030.00317.14
8.0.190.0040.00417.12
8.0.180.0080.00016.98
8.0.170.0040.00417.14
8.0.160.0040.00417.14
8.0.150.0040.00417.11
8.0.140.0000.00817.01
8.0.130.0000.00613.45
8.0.120.0030.00616.96
8.0.110.0040.00416.96
8.0.100.0030.00517.02
8.0.90.0000.00716.90
8.0.80.0150.00617.11
8.0.70.0050.00216.98
8.0.60.0040.00417.05
8.0.50.0000.00716.97
8.0.30.0100.01017.46
8.0.20.0120.00617.55
8.0.10.0040.00417.16
8.0.00.0090.00916.94
7.4.330.0050.00015.16
7.4.320.0030.00316.75
7.4.300.0040.00416.66
7.4.290.0060.00316.74
7.4.280.0050.00216.77
7.4.270.0030.00316.83
7.4.260.0000.01016.77
7.4.250.0050.00316.85
7.4.240.0010.00616.79
7.4.230.0000.00816.87
7.4.220.0110.00716.95
7.4.210.0030.01316.81
7.4.200.0040.00416.71
7.4.160.0190.00416.66
7.4.150.0090.00917.40
7.4.140.0100.00917.86
7.4.130.0120.00816.66
7.4.120.0060.01116.76
7.4.110.0060.01016.81
7.4.100.0100.00716.88
7.4.90.0070.01116.71
7.4.80.0120.01119.39
7.4.70.0060.01016.71
7.4.60.0090.01316.88
7.4.50.0040.00016.63
7.4.40.0060.01016.75
7.4.30.0140.00416.74
7.4.00.0070.01015.37
7.3.330.0030.00313.27
7.3.320.0000.00613.28
7.3.310.0040.00416.49
7.3.300.0030.00316.55
7.3.290.0040.01116.53
7.3.280.0110.00916.54
7.3.270.0070.01017.40
7.3.260.0060.01516.57
7.3.250.0070.01316.60
7.3.240.0110.00616.64
7.3.230.0120.00916.78
7.3.210.0060.01016.71
7.3.200.0100.00719.39
7.3.190.0090.01316.52
7.3.180.0130.00716.61
7.3.170.0030.01316.45
7.3.160.0030.01216.66
7.3.120.0060.01014.85
7.2.330.0090.00916.81
7.2.320.0090.00916.87
7.2.310.0080.01016.80
7.2.300.0100.01416.89
7.2.290.0080.00817.03
7.2.00.0110.00719.82
7.1.100.0000.01118.13
7.1.70.0000.00717.02
7.1.60.0140.00719.70
7.1.50.0150.00916.84
7.1.00.0030.07722.44
7.0.200.0070.00016.92
7.0.140.0070.07322.09
7.0.60.0070.04719.83
7.0.50.0000.08317.82
7.0.40.0030.09020.24
7.0.30.0270.07720.14
7.0.20.0370.04020.14
7.0.10.0100.03720.05
7.0.00.0030.08320.19
5.6.280.0070.07021.12
5.6.210.0100.05320.47
5.6.200.0130.08018.21
5.6.190.0070.08720.43
5.6.180.0300.07720.57
5.6.170.0200.04020.47
5.6.160.0100.08020.49
5.6.150.0030.05018.18
5.6.140.0100.06318.10
5.6.130.0070.07718.16
5.6.120.0100.04021.13
5.6.110.0030.04320.97
5.6.100.0070.04321.08
5.6.90.0030.04721.10
5.6.80.0070.03720.35
5.5.350.4330.03720.52
5.5.340.0070.03717.89
5.5.330.0070.08720.21
5.5.320.0070.05320.29
5.5.310.0230.03720.29
5.5.300.0000.04317.98
5.5.290.0070.03718.00
5.5.280.0170.08020.89
5.5.270.0030.04020.75
5.5.260.0130.05720.87
5.5.250.0130.05020.57
5.5.240.0170.04320.15
5.4.450.0030.04319.43
5.4.440.0030.04319.25
5.4.430.0030.03719.42
5.4.420.0000.04019.38
5.4.410.0070.03319.13
5.4.400.0100.03319.13
5.4.390.0000.04019.10
5.4.380.0030.03319.14
5.4.370.0070.03719.25
5.4.360.0000.04019.12
5.4.350.0030.04719.16
5.4.340.0130.02718.78
5.4.320.0070.04019.25
5.4.310.0030.03718.89
5.4.300.0030.03718.80
5.4.290.0100.03018.79
5.4.280.0030.03718.80
5.4.270.0070.03319.08
5.4.260.0070.03718.89
5.4.250.0000.03718.88
5.4.240.0030.03719.20
5.4.230.0070.03319.07
5.4.220.0030.04019.07
5.4.210.0000.04319.09
5.4.200.0000.03719.23
5.4.190.0000.03719.05
5.4.180.0000.04019.08
5.4.170.0000.03719.07
5.4.160.0030.03719.24
5.4.150.0000.04019.06
5.4.140.0030.03316.46
5.4.130.0000.03716.29
5.4.120.0030.03316.27
5.4.110.0070.03016.43
5.4.100.0070.03016.50
5.4.90.0030.03016.43
5.4.80.0070.03016.37
5.4.70.0070.03316.45
5.4.60.0070.03016.32
5.4.50.0070.03016.39
5.4.40.0030.03716.45
5.4.30.0170.03716.36
5.4.20.0030.03316.43
5.4.10.0000.03716.20
5.4.00.0000.03315.88
5.3.290.0030.03714.52
5.3.280.0070.03014.43
5.3.270.0030.03314.62
5.3.260.0000.04314.55
5.3.250.0000.03714.62
5.3.240.0000.03714.57
5.3.230.0030.03714.47
5.3.220.0000.03714.40
5.3.210.0030.03314.47
5.3.200.0000.03714.61
5.3.190.0070.03714.47
5.3.180.0000.03714.53
5.3.170.0000.03714.61
5.3.160.0000.04014.41
5.3.150.0070.03014.47
5.3.140.0000.03714.51
5.3.130.0000.03714.49
5.3.120.0000.03714.50
5.3.110.0000.04014.39
5.3.100.0030.03313.88
5.3.90.0070.03013.97
5.3.80.0000.03713.87
5.3.70.0070.03013.96
5.3.60.0000.04313.95
5.3.50.0030.03313.86
5.3.40.0030.03313.93
5.3.30.0000.03713.86
5.3.20.0000.03313.86
5.3.10.0000.03313.86
5.3.00.0070.03013.86
5.2.170.0030.02713.86
5.2.160.0000.03013.86
5.2.150.0000.03313.86
5.2.140.0000.03313.86
5.2.130.0000.04013.86
5.2.120.0030.03013.86
5.2.110.0030.04013.86
5.2.100.0130.02713.86
5.2.90.0000.05013.86
5.2.80.0070.03013.86
5.2.70.0030.04713.86
5.2.60.0030.03313.86
5.2.50.0030.06013.86
5.2.40.0000.05013.86
5.2.30.0000.05713.86
5.2.20.0070.03013.86
5.2.10.0030.04713.86
5.2.00.0030.04313.86
5.1.60.0000.03713.86
5.1.50.0070.05013.86
5.1.40.0030.05713.86
5.1.30.0000.05313.86
5.1.20.0030.05313.86
5.1.10.0000.02713.86
5.1.00.0100.05013.86
5.0.50.0070.02713.86
5.0.40.0000.03713.86
5.0.30.0030.04013.86
5.0.20.0030.04013.86
5.0.10.0030.04313.86
5.0.00.0030.06013.86
4.4.90.0000.02013.86
4.4.80.0030.03013.86
4.4.70.0030.02313.86
4.4.60.0030.01713.86
4.4.50.0030.01713.86
4.4.40.0000.02713.86
4.4.30.0030.02313.86
4.4.20.0030.01313.86
4.4.10.0000.02313.86
4.4.00.0030.02713.86
4.3.110.0030.03313.86
4.3.100.0000.02713.86
4.3.90.0000.02313.86
4.3.80.0000.05013.86
4.3.70.0000.02013.86
4.3.60.0030.01713.86
4.3.50.0070.03013.86
4.3.40.0000.03013.86
4.3.30.0000.04013.86
4.3.20.0030.02013.86
4.3.10.0000.03713.86
4.3.00.0000.03713.86

preferences:
41.85 ms | 401 KiB | 5 Q