3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test1 = '07511 111111'; $test2 = '+447511 111111'; $test3 = '+44 (0) 7511 111111'; //step 1 - reduce it to digits: preg_match_all('([\+]{0,1}[^\(\) ][0-9]+)', $test3, $digits); $digits = implode($digits[0]); var_dump($digits); //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); } var_dump(substr($digits, 3, 1)); var_dump(strlen($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 "valid 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.0040.01116.75
8.3.50.0130.00522.13
8.3.40.0120.00619.10
8.3.30.0140.00019.09
8.3.20.0080.00020.35
8.3.10.0040.00423.61
8.3.00.0030.00519.66
8.2.180.0180.00418.40
8.2.170.0110.00422.96
8.2.160.0070.01320.52
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00420.87
8.2.110.0030.00622.37
8.2.100.0000.01117.66
8.2.90.0050.00319.22
8.2.80.0000.00817.97
8.2.70.0040.00417.75
8.2.60.0080.00018.05
8.2.50.0040.00418.07
8.2.40.0090.00018.28
8.2.30.0000.00818.35
8.2.20.0000.00917.77
8.2.10.0000.00718.21
8.2.00.0030.00617.95
8.1.280.0100.00725.92
8.1.270.0040.00422.07
8.1.260.0040.00426.35
8.1.250.0050.00228.09
8.1.240.0040.00423.97
8.1.230.0080.00319.03
8.1.220.0050.00317.78
8.1.210.0040.00418.77
8.1.200.0100.00017.35
8.1.190.0080.00017.35
8.1.180.0060.00318.10
8.1.170.0040.00418.63
8.1.160.0040.00422.04
8.1.150.0070.00018.68
8.1.140.0000.00717.48
8.1.130.0000.00717.85
8.1.120.0040.00417.50
8.1.110.0040.00417.67
8.1.100.0030.00517.55
8.1.90.0000.00717.51
8.1.80.0040.00417.46
8.1.70.0070.00017.56
8.1.60.0040.00417.79
8.1.50.0030.00617.62
8.1.40.0000.00917.59
8.1.30.0000.00817.77
8.1.20.0030.00517.82
8.1.10.0080.00017.71
8.1.00.0030.00617.54
8.0.300.0000.00718.77
8.0.290.0040.00416.88
8.0.280.0030.00318.45
8.0.270.0050.00217.26
8.0.260.0000.00617.32
8.0.250.0000.00716.98
8.0.240.0000.00717.08
8.0.230.0040.00417.08
8.0.220.0030.00316.87
8.0.210.0050.00216.95
8.0.200.0000.00717.16
8.0.190.0000.00817.15
8.0.180.0040.00417.09
8.0.170.0030.00617.04
8.0.160.0040.00316.91
8.0.150.0070.00016.88
8.0.140.0040.00417.04
8.0.130.0000.00513.51
8.0.120.0030.00617.02
8.0.110.0000.00717.04
8.0.100.0000.00916.85
8.0.90.0000.00816.88
8.0.80.0130.00317.07
8.0.70.0070.00016.93
8.0.60.0030.00516.98
8.0.50.0040.00417.10
8.0.30.0090.01217.11
8.0.20.0140.00717.43
8.0.10.0000.00717.15
8.0.00.0080.01016.83
7.4.330.0000.00515.00
7.4.320.0030.00316.70
7.4.300.0000.00716.69
7.4.290.0040.00316.72
7.4.280.0000.00716.78
7.4.270.0000.00716.71
7.4.260.0100.00016.77
7.4.250.0000.00816.68
7.4.240.0020.00516.83
7.4.230.0030.00316.82
7.4.220.0160.00616.83
7.4.210.0040.01116.75
7.4.200.0030.00316.65
7.4.160.0110.00716.73
7.4.150.0070.01117.40
7.4.140.0130.00917.86
7.4.130.0110.00616.81
7.4.120.0100.00616.79
7.4.110.0080.00816.79
7.4.100.0140.00316.68
7.4.90.0080.01016.66
7.4.80.0170.00319.39
7.4.70.0070.01116.66
7.4.60.0110.01216.66
7.4.50.0030.00316.82
7.4.40.0060.00916.62
7.4.30.0040.01216.70
7.4.10.0090.00916.54
7.4.00.0100.00615.91
7.3.330.0050.00013.25
7.3.320.0030.00313.11
7.3.310.0000.00716.37
7.3.300.0070.00016.31
7.3.290.0170.00316.36
7.3.280.0090.00916.45
7.3.270.0160.00317.40
7.3.260.0030.01316.70
7.3.250.0060.01116.67
7.3.240.0090.01016.86
7.3.230.0140.00316.75
7.3.210.0090.00916.48
7.3.200.0130.00319.39
7.3.190.0030.01316.84
7.3.180.0000.01516.41
7.3.170.0040.01916.54
7.3.160.0060.00916.48
7.3.130.0090.00916.44
7.3.120.0050.01115.87
7.3.110.0070.01016.48
7.3.100.0090.00616.69
7.3.90.0070.00716.58
7.3.80.0100.00716.72
7.3.70.0040.01116.58
7.3.60.0080.00316.32
7.3.50.0120.00316.49
7.3.40.0060.00916.54
7.3.30.0060.00316.61
7.3.20.0040.01118.38
7.3.10.0060.00618.37
7.3.00.0060.00918.22
7.2.330.0150.00316.87
7.2.320.0130.00616.74
7.2.310.0140.00316.75
7.2.300.0100.00616.78
7.2.290.0160.01017.01
7.2.260.0060.01316.71
7.2.250.0100.00716.59
7.2.240.0060.00616.66
7.2.230.0030.01516.71
7.2.220.0060.00916.89
7.2.210.0060.01016.92
7.2.200.0060.00916.65
7.2.190.0030.00916.68
7.2.180.0060.01216.63
7.2.170.0070.00316.74
7.2.160.0000.01116.47
7.2.150.0040.01518.44
7.2.140.0030.01318.38
7.2.130.0040.01118.56
7.2.120.0040.00817.72
7.2.110.0040.01017.40
7.2.100.0020.00917.33
7.2.90.0070.00617.29
7.2.80.0080.00617.41
7.2.70.0070.00817.49
7.2.60.0070.00717.31
7.2.50.0020.01117.44
7.2.40.0070.00917.52
7.2.30.0060.00917.62
7.2.20.0050.01017.62
7.2.10.0080.00717.42
7.2.00.0040.00817.86
7.1.330.0030.01317.50
7.1.320.0040.01117.70
7.1.310.0030.01117.38
7.1.300.0100.00017.43
7.1.290.0100.00317.59
7.1.280.0030.00617.71
7.1.270.0060.00617.53
7.1.260.0000.01417.55
7.1.250.0070.00717.43
7.1.240.0110.00216.59
7.1.230.0040.00816.51
7.1.220.0030.01016.52
7.1.210.0040.00916.48
7.1.200.0020.01116.35
7.1.190.0050.00716.56
7.1.180.0060.00616.53
7.1.170.0110.00316.42
7.1.160.0100.00616.45
7.1.150.0070.00616.46
7.1.140.0040.00916.44
7.1.130.0050.00616.50
7.1.120.0060.00716.44
7.1.110.0080.00416.50
7.1.100.0060.00616.95
7.1.90.0080.00516.45
7.1.80.0040.00716.56
7.1.70.0050.00716.69
7.1.60.0020.01317.40
7.1.50.0080.01116.56
7.1.40.0080.00816.64
7.1.30.0050.00516.60
7.1.20.0070.00616.56
7.1.10.0030.00916.44
7.1.00.0040.02517.94
7.0.330.0030.01016.91
7.0.320.0030.00916.39
7.0.310.0070.00616.05
7.0.300.0070.00616.20
7.0.290.0050.00816.16
7.0.280.0050.00715.93
7.0.270.0080.00516.08
7.0.260.0040.00816.06
7.0.250.0010.01016.00
7.0.240.0040.00916.08
7.0.230.0060.00716.23
7.0.220.0050.00816.03
7.0.210.0040.00816.11
7.0.200.0060.00716.23
7.0.190.0030.00616.25
7.0.180.0030.00816.17
7.0.170.0050.00716.17
7.0.160.0050.00816.16
7.0.150.0040.00916.08
7.0.140.0100.02017.71
7.0.130.0040.00616.13
7.0.120.0080.00616.13
7.0.110.0050.00416.09
7.0.100.0020.01116.07
7.0.90.0060.00616.13
7.0.80.0050.00616.19
7.0.70.0040.00916.21
7.0.60.0050.02717.13
7.0.50.0050.02216.59
7.0.40.0070.01515.68
7.0.30.0070.01815.66
7.0.20.0100.01615.64
7.0.10.0090.02315.65
7.0.00.0060.01415.66
5.6.400.0080.00616.05
5.6.390.0030.01016.28
5.6.380.0020.01215.17
5.6.370.0080.00615.06
5.6.360.0090.00614.87
5.6.350.0060.00915.12
5.6.340.0070.00914.84
5.6.330.0060.00614.97
5.6.320.0050.01015.06
5.6.310.0050.00715.01
5.6.300.0070.00814.91
5.6.290.0040.00814.92
5.6.280.0060.02316.59
5.6.270.0080.00815.07
5.6.260.0060.00914.96
5.6.250.0050.00614.94
5.6.240.0080.00515.00
5.6.230.0040.00915.04
5.6.220.0050.00715.00
5.6.210.0080.02416.30
5.6.200.0080.02315.79
5.6.190.0060.02816.34
5.6.180.0090.01916.38
5.6.170.0100.01716.35
5.6.160.0050.01616.44
5.6.150.0080.02315.83
5.6.140.0090.02015.71
5.6.130.0030.02715.72
5.6.120.0040.02916.60
5.6.110.0070.02616.49
5.6.100.0130.01716.46
5.6.90.0040.02616.52
5.6.80.0030.02016.25
5.6.70.0060.00914.94
5.6.60.0050.01014.92
5.6.50.0100.00315.01
5.6.40.0060.00915.03
5.6.30.0040.01114.73
5.6.20.0070.00914.75
5.6.10.0040.00814.89
5.6.00.0090.00414.93
5.5.380.0090.00413.28
5.5.370.0030.00713.37
5.5.360.0030.00713.28
5.5.350.0090.02514.99
5.5.340.0040.02514.55
5.5.330.0060.02015.03
5.5.320.0130.01315.14
5.5.310.0110.01815.03
5.5.300.0050.02114.49
5.5.290.0050.02614.51
5.5.280.0060.01915.21
5.5.270.0060.01815.22
5.5.260.0020.01515.30
5.5.250.0060.01215.13
5.5.240.0020.01415.05
5.5.230.0030.00813.27
5.5.220.0020.00913.31
5.5.210.0040.00613.31
5.5.200.0070.00213.28
5.5.190.0020.00913.23
5.5.180.0020.00913.36
5.5.170.0040.00814.84
5.5.160.0060.00613.29
5.5.150.0060.00413.33
5.5.140.0060.00613.26
5.5.130.0060.00213.25
5.5.120.0060.00613.26
5.5.110.0010.00913.37
5.5.100.0050.00613.33
5.5.90.0060.00613.25
5.5.80.0010.00913.30
5.5.70.0080.00413.29
5.5.60.0020.00813.28
5.5.50.0020.00813.34
5.5.40.0060.00613.29
5.5.30.0100.00213.25
5.5.20.0010.00913.30
5.5.10.0070.00313.25
5.5.00.0060.00613.31
5.4.450.0100.01420.22
5.4.440.0080.02514.05
5.4.430.0160.01620.13
5.4.420.0190.01620.17
5.4.410.0160.01520.18
5.4.400.0120.01420.09
5.4.390.0070.01720.16
5.4.380.0070.02113.86
5.4.370.0080.01713.78
5.4.360.0030.02013.81
5.4.350.0060.01913.84
5.4.340.0070.01613.78
5.4.330.0050.00612.22
5.4.320.0040.01612.29
5.4.310.0050.01512.34
5.4.300.0060.01312.32
5.4.290.0050.01412.27
5.4.280.0030.01512.28
5.4.270.0040.01712.26
5.4.260.0040.01512.29
5.4.250.0040.01512.30
5.4.240.0030.01412.27
5.4.230.0070.01212.27
5.4.220.0020.01612.24
5.4.210.0060.01512.22
5.4.200.0040.01312.30
5.4.190.0040.01612.23
5.4.180.0070.01212.26
5.4.170.0050.01412.25
5.4.160.0060.01212.24
5.4.150.0070.01212.28
5.4.140.0040.01412.22
5.4.130.0060.01312.19
5.4.120.0040.01312.25
5.4.110.0060.01412.22
5.4.100.0040.01412.16
5.4.90.0030.01412.16
5.4.80.0030.01412.20
5.4.70.0020.01412.16
5.4.60.0050.01612.18
5.4.50.0040.01412.18
5.4.40.0040.01312.16
5.4.30.0040.01212.17
5.4.20.0040.01512.16
5.4.10.0020.01712.16
5.4.00.0060.01212.06
5.3.290.0060.01312.49
5.3.280.0060.01312.43
5.3.270.0050.01512.46
5.3.260.0050.01412.45
5.3.250.0050.01412.46
5.3.240.0070.01312.48
5.3.230.0060.01112.42
5.3.220.0050.01312.46
5.3.210.0060.01212.41
5.3.200.0040.01312.43
5.3.190.0060.01212.51
5.3.180.0050.01212.49
5.3.170.0060.01712.46
5.3.160.0030.01512.50
5.3.150.0050.01312.43
5.3.140.0040.01512.48
5.3.130.0050.01412.45
5.3.120.0050.01612.44
5.3.110.0070.01112.41
5.3.100.0040.01512.32
5.3.90.0040.01212.29
5.3.80.0050.01312.25
5.3.70.0030.01612.26
5.3.60.0030.01512.33
5.3.50.0050.01512.24
5.3.40.0050.01312.25
5.3.30.0030.01512.25
5.3.20.0030.01412.24
5.3.10.0050.01312.13
5.3.00.0030.01412.13
5.2.170.0050.01211.08
5.2.160.0030.01311.08
5.2.150.0020.01511.08
5.2.140.0030.01411.08
5.2.130.0040.01211.07
5.2.120.0050.01311.07
5.2.110.0040.01311.07
5.2.100.0040.01111.07
5.2.90.0050.01211.07
5.2.80.0020.01211.07
5.2.70.0040.01311.07
5.2.60.0040.01111.05
5.2.50.0060.01211.04
5.2.40.0050.01211.04
5.2.30.0050.01511.03
5.2.20.0030.01411.03
5.2.10.0060.00910.99
5.2.00.0020.01410.95
5.1.60.0030.01310.71
5.1.50.0020.01410.71
5.1.40.0040.01110.70
5.1.30.0060.01110.82
5.1.20.0030.00910.83
5.1.10.0050.01010.73
5.1.00.0030.01410.73
5.0.50.0030.01010.23
5.0.40.0020.01010.18
5.0.30.0020.01510.12
5.0.20.0030.01310.11
5.0.10.0050.00810.10
5.0.00.0050.01310.10
4.4.90.0020.0089.61
4.4.80.0010.0099.60
4.4.70.0020.0089.60
4.4.60.0020.0079.60
4.4.50.0040.0079.61
4.4.40.0030.0149.59
4.4.30.0030.0079.61
4.4.20.0050.0069.63
4.4.10.0040.0069.63
4.4.00.0020.0119.61
4.3.110.0020.0089.58
4.3.100.0030.0079.58
4.3.90.0020.0079.56
4.3.80.0040.0109.55
4.3.70.0020.0099.56
4.3.60.0030.0099.56
4.3.50.0010.0109.56
4.3.40.0000.0129.53
4.3.30.0020.0109.12
4.3.20.0010.0109.11
4.3.10.0020.0099.10
4.3.00.0010.00922.62

preferences:
51.34 ms | 401 KiB | 5 Q