3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = ['07511 111111', '+447511 111111', '+44 (0) 7511 111111', '07211 111111', '3749853857', '0712121211233', 'abcd', '074687774']; 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.00616.75
8.3.50.0120.00722.11
8.3.40.0120.00318.92
8.3.30.0110.00419.07
8.3.20.0040.00420.16
8.3.10.0040.00423.65
8.3.00.0080.00019.68
8.2.180.0090.00916.75
8.2.170.0110.00422.96
8.2.160.0100.00720.33
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0030.01026.16
8.2.120.0040.00421.05
8.2.110.0040.00420.48
8.2.100.0100.00319.64
8.2.90.0040.00418.00
8.2.80.0050.00518.91
8.2.70.0060.00317.88
8.2.60.0000.00817.61
8.2.50.0040.00417.75
8.2.40.0040.00419.61
8.2.30.0030.00518.37
8.2.20.0040.00418.01
8.2.10.0030.00618.06
8.2.00.0040.00418.05
8.1.280.0140.00325.92
8.1.270.0090.00023.63
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00420.53
8.1.230.0110.00017.82
8.1.220.0050.00317.79
8.1.210.0080.00018.77
8.1.200.0040.00417.38
8.1.190.0050.00317.35
8.1.180.0060.00318.10
8.1.170.0030.00517.65
8.1.160.0040.00422.06
8.1.150.0040.00418.81
8.1.140.0040.00417.58
8.1.130.0070.00017.93
8.1.120.0000.00817.65
8.1.110.0040.00417.64
8.1.100.0040.00417.61
8.1.90.0050.00317.68
8.1.80.0050.00217.67
8.1.70.0030.00317.53
8.1.60.0020.00517.75
8.1.50.0050.00317.62
8.1.40.0040.00417.73
8.1.30.0030.00517.79
8.1.20.0080.00317.88
8.1.10.0050.00317.76
8.1.00.0000.00717.70
8.0.300.0000.00818.77
8.0.290.0080.00016.75
8.0.280.0040.00418.54
8.0.270.0090.00017.30
8.0.260.0030.00317.41
8.0.250.0000.00717.15
8.0.240.0030.00317.17
8.0.230.0000.00817.10
8.0.220.0000.00817.09
8.0.210.0000.00717.09
8.0.200.0040.00417.10
8.0.190.0030.00917.09
8.0.180.0040.00417.00
8.0.170.0050.00317.16
8.0.160.0000.00817.01
8.0.150.0000.00817.07
8.0.140.0070.00017.07
8.0.130.0000.00613.48
8.0.120.0000.00817.05
8.0.110.0000.00716.98
8.0.100.0050.00317.13
8.0.90.0070.00017.09
8.0.80.0060.00917.00
8.0.70.0040.00417.11
8.0.60.0040.00416.97
8.0.50.0050.00217.05
8.0.30.0080.01317.35
8.0.20.0160.00517.40
8.0.10.0050.00317.14
8.0.00.0120.00817.00
7.4.330.0000.00515.17
7.4.320.0030.00316.79
7.4.300.0030.00316.83
7.4.290.0030.00316.83
7.4.280.0040.00416.63
7.4.270.0030.00416.65
7.4.260.0060.00316.85
7.4.250.0000.00916.72
7.4.240.0050.00316.84
7.4.230.0000.00716.94
7.4.220.0060.01216.86
7.4.210.0110.00716.73
7.4.200.0030.00316.63
7.4.160.0040.01216.72
7.4.150.0130.00317.40
7.4.140.0080.00817.86
7.4.130.0090.00816.75
7.4.120.0050.01216.67
7.4.110.0100.01316.89
7.4.100.0040.01416.69
7.4.90.0040.01316.72
7.4.80.0140.01019.39
7.4.70.0070.01016.64
7.4.60.0070.01416.66
7.4.50.0000.00516.90
7.4.40.0030.01416.55
7.4.30.0070.01016.71
7.4.00.0070.00714.96
7.3.330.0030.00413.34
7.3.320.0080.00013.20
7.3.310.0000.00616.57
7.3.300.0030.00316.41
7.3.290.0030.01716.41
7.3.280.0080.01116.49
7.3.270.0150.00617.40
7.3.260.0080.01216.84
7.3.250.0080.01116.65
7.3.240.0090.00916.51
7.3.230.0120.00616.82
7.3.210.0100.00716.66
7.3.200.0110.00719.39
7.3.190.0090.00916.48
7.3.180.0130.00316.79
7.3.170.0060.00916.61
7.3.160.0100.00716.73
7.3.120.0070.00715.05
7.2.330.0080.00816.94
7.2.320.0090.01316.92
7.2.310.0070.01116.79
7.2.300.0100.00616.89
7.2.290.0160.00016.67
7.2.00.0000.01219.84
7.1.100.0880.01116.54
7.1.70.0000.00917.54
7.1.60.0100.01419.70
7.1.50.0110.01516.83
7.1.00.0070.07322.35
7.0.200.0060.00316.92
7.0.140.0100.07021.90
7.0.60.0070.07320.03
7.0.50.0130.08017.68
7.0.40.0100.08020.25
7.0.30.0130.04720.20
7.0.20.0400.05720.14
7.0.10.0000.09320.18
7.0.00.0030.05020.22
5.6.280.0070.07021.09
5.6.210.0100.06720.74
5.6.200.0030.07018.13
5.6.190.0030.04320.64
5.6.180.4030.04020.68
5.6.170.0200.06720.44
5.6.160.0100.03320.61
5.6.150.0100.05318.22
5.6.140.0030.07318.07
5.6.130.0030.06718.25
5.6.120.0100.08320.89
5.6.110.0100.07321.01
5.6.100.0070.08321.13
5.6.90.0130.08320.88
5.6.80.0070.07720.34
5.6.70.4330.03320.36
5.5.350.0030.08020.38
5.5.340.0100.07718.01
5.5.330.0000.07020.54
5.5.320.0400.06320.30
5.5.310.0270.05320.32
5.5.300.0100.08018.01
5.5.290.0070.05017.92
5.5.280.0100.06020.96
5.5.270.0030.04020.68
5.5.260.0100.07020.77
5.5.250.0100.07720.69
5.5.240.3570.03720.29
5.4.450.0800.04319.42
5.4.440.0200.05043.92
5.4.430.0200.03343.91
5.4.420.0230.04043.90
5.4.410.0470.04343.90
5.4.400.0770.04743.88
5.4.390.0300.03743.86
5.4.380.0200.05718.61
5.4.370.0130.05018.59
5.4.360.0100.05318.66
5.4.350.0070.06018.68
5.4.340.0130.05018.64
5.4.320.0060.03812.46
5.4.310.0040.03812.45
5.4.300.0040.04012.46
5.4.290.0030.04112.45
5.4.280.0070.03612.35
5.4.270.0030.04112.35
5.4.260.0060.03712.35
5.4.250.0030.04012.35
5.4.240.0030.03912.35
5.4.230.0060.03712.34
5.4.220.0070.04012.34
5.4.210.0070.03712.34
5.4.200.0080.04112.34
5.4.190.0070.04012.34
5.4.180.0070.03912.34
5.4.170.0030.03912.35
5.4.160.0070.03512.34
5.4.150.0110.03512.34
5.4.140.0050.03712.02
5.4.130.0080.03412.02
5.4.120.0050.03511.97
5.4.110.0070.03411.97
5.4.100.0050.04111.96
5.4.90.0090.03811.97
5.4.80.0080.03811.97
5.4.70.0080.03311.96
5.4.60.0040.03611.96
5.4.50.0050.03611.96
5.4.40.0060.03311.95
5.4.30.0060.03511.95
5.4.20.0070.03811.95
5.4.10.0070.03411.95
5.4.00.0060.03611.44
5.3.290.0080.05412.80
5.3.280.0060.03712.71
5.3.270.0090.03912.73
5.3.260.0060.04912.72
5.3.250.0090.03412.72
5.3.240.0060.03712.72
5.3.230.0070.04112.71
5.3.220.0040.03912.68
5.3.210.0040.04412.68
5.3.200.0060.03712.68
5.3.190.0030.04012.68
5.3.180.0040.04212.68
5.3.170.0050.03812.66
5.3.160.0040.03812.67
5.3.150.0060.03612.67
5.3.140.0090.03412.66
5.3.130.0080.03712.65
5.3.120.0090.03512.66
5.3.110.0040.04512.66
5.3.100.0090.03712.11
5.3.90.0070.03712.08
5.3.80.0110.03412.07
5.3.70.0090.03312.07
5.3.60.0040.03812.06
5.3.50.0080.04012.00
5.3.40.0040.04312.00
5.3.30.0070.03811.95
5.3.20.0080.03711.73
5.3.10.0070.03311.70
5.3.00.0060.04311.68
5.2.170.0030.0329.18
5.2.160.0070.0279.18
5.2.150.0050.0309.18
5.2.140.0040.0319.18
5.2.130.0080.0289.14
5.2.120.0070.0279.14
5.2.110.0030.0319.14
5.2.100.0060.0339.14
5.2.90.0060.0289.14
5.2.80.0080.0309.14
5.2.70.0090.0269.14
5.2.60.0040.0349.09
5.2.50.0040.0309.05
5.2.40.0050.0289.03
5.2.30.0040.0299.01
5.2.20.0010.0329.00
5.2.10.0030.0298.93
5.2.00.0030.0318.79
5.1.60.0030.0268.07
5.1.50.0030.0268.06
5.1.40.0020.0288.05
5.1.30.0090.0218.40
5.1.20.0060.0278.41
5.1.10.0050.0268.14
5.1.00.0030.0268.14
5.0.50.0080.0216.63
5.0.40.0050.0266.48
5.0.30.0050.0326.29
5.0.20.0050.0256.26
5.0.10.0030.0286.24
5.0.00.0070.0276.23
4.4.90.0040.0224.78
4.4.80.0030.0154.76
4.4.70.0040.0144.76
4.4.60.0020.0164.75
4.4.50.0050.0134.77
4.4.40.0040.0314.71
4.4.30.0040.0204.76
4.4.20.0040.0134.84
4.4.10.0030.0154.85
4.4.00.0040.0334.76
4.3.110.0010.0174.67
4.3.100.0050.0164.67
4.3.90.0020.0154.63
4.3.80.0020.0254.58
4.3.70.0030.0144.63
4.3.60.0050.0124.63
4.3.50.0040.0144.63
4.3.40.0040.0244.54
4.3.30.0020.0173.28
4.3.20.0010.0203.26
4.3.10.0010.0193.22
4.3.00.0030.01743.83

preferences:
65 ms | 401 KiB | 5 Q