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]+)', $test1, $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); } //by this point we should have just a UK-style number, but we must validate it: if ((substr($digits, 3, 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.0090.01216.75
8.3.50.0110.00821.99
8.3.40.0110.00319.01
8.3.30.0140.00019.09
8.3.20.0070.00020.21
8.3.10.0000.00823.71
8.3.00.0040.00419.79
8.2.180.0190.00016.63
8.2.170.0140.00722.96
8.2.160.0070.01320.47
8.2.150.0080.00024.18
8.2.140.0060.00624.66
8.2.130.0070.00726.16
8.2.120.0040.01121.11
8.2.110.0030.00622.20
8.2.100.0040.00717.91
8.2.90.0030.00519.18
8.2.80.0000.00817.97
8.2.70.0040.00417.75
8.2.60.0040.00418.04
8.2.50.0040.00418.07
8.2.40.0060.00618.14
8.2.30.0050.00218.29
8.2.20.0000.00817.89
8.2.10.0040.00418.14
8.2.00.0080.00017.97
8.1.280.0120.00625.92
8.1.270.0060.00322.14
8.1.260.0030.00626.35
8.1.250.0030.00628.09
8.1.240.0040.00423.72
8.1.230.0050.00519.21
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0060.00317.47
8.1.190.0080.00017.38
8.1.180.0080.00018.10
8.1.170.0050.00318.64
8.1.160.0050.00322.05
8.1.150.0050.00318.79
8.1.140.0060.00317.63
8.1.130.0000.00717.76
8.1.120.0080.00017.56
8.1.110.0000.00717.66
8.1.100.0030.00417.63
8.1.90.0020.00517.57
8.1.80.0040.00417.65
8.1.70.0000.00717.62
8.1.60.0030.00617.76
8.1.50.0030.00517.70
8.1.40.0030.00517.59
8.1.30.0050.00317.70
8.1.20.0000.00817.73
8.1.10.0030.00517.62
8.1.00.0000.00917.57
8.0.300.0000.00818.77
8.0.290.0040.00416.88
8.0.280.0030.00318.45
8.0.270.0000.00717.28
8.0.260.0000.00617.29
8.0.250.0040.00417.09
8.0.240.0080.00017.07
8.0.230.0000.00717.13
8.0.220.0000.00717.07
8.0.210.0040.00417.10
8.0.200.0030.00317.13
8.0.190.0000.00917.08
8.0.180.0000.00717.01
8.0.170.0000.00817.05
8.0.160.0080.00016.91
8.0.150.0040.00417.00
8.0.140.0070.00017.01
8.0.130.0000.00513.52
8.0.120.0050.00317.06
8.0.110.0000.00716.98
8.0.100.0040.00417.04
8.0.90.0040.00416.90
8.0.80.0100.00616.98
8.0.70.0000.00817.12
8.0.60.0030.00616.91
8.0.50.0080.00017.05
8.0.30.0060.01317.08
8.0.20.0060.01317.40
8.0.10.0000.00817.16
8.0.00.0070.01017.10
7.4.330.0000.00515.12
7.4.320.0060.00016.64
7.4.300.0030.00316.74
7.4.290.0040.00416.81
7.4.280.0070.00016.62
7.4.270.0040.00416.83
7.4.260.0060.00316.71
7.4.250.0050.00316.66
7.4.240.0020.00516.79
7.4.230.0000.00816.57
7.4.220.0140.00316.60
7.4.210.0000.01416.75
7.4.200.0030.00416.86
7.4.160.0060.01016.61
7.4.150.0090.00917.40
7.4.140.0140.00317.86
7.4.130.0080.01016.74
7.4.120.0080.00816.73
7.4.110.0030.01316.74
7.4.100.0060.01216.77
7.4.90.0030.01316.73
7.4.80.0060.01519.39
7.4.70.0080.00816.80
7.4.60.0080.00816.59
7.4.50.0000.00816.50
7.4.40.0060.01116.80
7.4.30.0080.00816.65
7.4.10.0130.00616.80
7.4.00.0100.00815.92
7.3.330.0030.00313.19
7.3.320.0000.00513.37
7.3.310.0000.00816.53
7.3.300.0040.00416.30
7.3.290.0110.00316.40
7.3.280.0100.00716.36
7.3.270.0100.01017.40
7.3.260.0180.00616.63
7.3.250.0090.01116.55
7.3.240.0070.01116.51
7.3.230.0060.01616.43
7.3.210.0140.00316.63
7.3.200.0160.00319.39
7.3.190.0090.01216.66
7.3.180.0120.00616.59
7.3.170.0070.01016.46
7.3.160.0090.00616.45
7.3.130.0060.01416.51
7.3.120.0060.01315.87
7.3.110.0060.00815.58
7.3.100.0060.00815.72
7.3.90.0100.00815.63
7.3.80.0060.00615.68
7.3.70.0070.01015.83
7.3.60.0040.01115.80
7.3.50.0090.00715.77
7.3.40.0060.00715.76
7.3.30.0090.00515.70
7.3.20.0050.01017.53
7.3.10.0100.00417.06
7.3.00.0080.01017.17
7.2.330.0120.00616.74
7.2.320.0060.01116.83
7.2.310.0170.00716.66
7.2.300.0000.01616.92
7.2.290.0100.00616.70
7.2.260.0040.01816.59
7.2.250.0040.01916.66
7.2.240.0110.00515.95
7.2.230.0070.00815.91
7.2.220.0050.00915.64
7.2.210.0050.00916.08
7.2.200.0070.00915.94
7.2.190.0070.00915.91
7.2.180.0050.01115.98
7.2.170.0050.00916.01
7.2.160.0070.01115.89
7.2.150.0100.00717.68
7.2.140.0040.01017.54
7.2.130.0080.00817.42
7.2.120.0100.00617.43
7.2.110.0100.00417.46
7.2.100.0090.00817.43
7.2.90.0090.00717.50
7.2.80.0040.01017.22
7.2.70.0100.00717.49
7.2.60.0050.01217.36
7.2.50.0110.00517.41
7.2.40.0070.01017.38
7.2.30.0070.00817.52
7.2.20.0070.00817.38
7.2.10.0070.01017.48
7.2.00.0070.00818.14
7.1.330.0030.01416.68
7.1.320.0050.01316.71
7.1.310.0080.00716.85
7.1.300.0090.00616.75
7.1.290.0080.00516.71
7.1.280.0040.00916.71
7.1.270.0120.00316.64
7.1.260.0040.01116.54
7.1.250.0090.00916.37
7.1.240.0000.01617.56
7.1.230.0040.01117.55
7.1.220.0070.00717.41
7.1.210.0080.00817.43
7.1.200.0050.00816.69
7.1.190.0070.01117.52
7.1.180.0090.00617.31
7.1.170.0000.01117.46
7.1.160.0030.01017.57
7.1.150.0030.01317.57
7.1.140.0110.00317.34
7.1.130.0000.01517.30
7.1.120.0090.00317.51
7.1.110.0080.00517.55
7.1.100.0050.00917.89
7.1.90.0040.01217.55
7.1.80.0040.01117.62
7.1.70.0010.01017.24
7.1.60.0090.00918.56
7.1.50.0110.00517.26
7.1.40.0070.01117.55
7.1.30.0040.00717.50
7.1.20.0000.01317.43
7.1.10.0070.00717.61
7.1.00.0030.04319.90
7.0.330.0060.00917.07
7.0.320.0060.00917.08
7.0.310.0030.01017.11
7.0.300.0090.00017.09
7.0.290.0080.00317.03
7.0.280.0090.00317.17
7.0.270.0040.01217.16
7.0.260.0000.01017.09
7.0.250.0030.00617.26
7.0.240.0070.01017.16
7.0.230.0110.00717.16
7.0.220.0030.01017.01
7.0.210.0090.00317.24
7.0.200.0030.00616.96
7.0.190.0000.01416.96
7.0.180.0030.00717.10
7.0.170.0100.00317.19
7.0.160.0090.00017.38
7.0.150.0070.01017.18
7.0.140.0040.04419.51
7.0.130.0070.00316.98
7.0.120.0060.00617.02
7.0.110.0070.01117.03
7.0.100.0030.01417.14
7.0.90.0110.00716.89
7.0.80.0000.00917.07
7.0.70.0030.00917.19
7.0.60.0050.03318.57
7.0.50.0100.02317.34
7.0.40.0050.03317.49
7.0.30.0190.02517.53
7.0.20.0180.04617.66
7.0.10.0220.02517.70
7.0.00.0050.04517.75
5.6.400.0110.00415.84
5.6.390.0060.00616.28
5.6.380.0070.01116.05
5.6.370.0070.00415.97
5.6.360.0040.01115.95
5.6.350.0120.00315.86
5.6.340.0080.00516.14
5.6.330.0040.00716.22
5.6.320.0000.01416.05
5.6.310.0050.00816.08
5.6.300.0040.01115.78
5.6.290.0130.00316.05
5.6.280.0030.04318.47
5.6.270.0030.01316.22
5.6.260.0030.00915.91
5.6.250.0040.01116.08
5.6.240.0030.00915.95
5.6.230.0090.00015.89
5.6.220.0040.01115.89
5.6.210.0070.02418.26
5.6.200.0030.04017.04
5.6.190.0140.03518.24
5.6.180.0050.02218.25
5.6.170.0120.03718.06
5.6.160.0030.02518.26
5.6.150.0120.04117.06
5.6.140.0060.02516.96
5.6.130.0070.04316.97
5.6.120.0120.03218.53
5.6.110.0100.03518.42
5.6.100.0050.03418.38
5.6.90.0050.04418.51
5.6.80.0070.03418.16
5.6.70.0090.00615.64
5.6.60.0030.01015.83
5.6.50.0060.00615.65
5.6.40.0070.00715.70
5.6.30.0070.01115.90
5.6.20.0100.00315.88
5.6.10.0070.00315.70
5.6.00.0100.00715.77
5.5.380.0080.00415.85
5.5.370.0070.00715.91
5.5.360.0060.00615.83
5.5.350.0050.02018.21
5.5.340.0030.02816.92
5.5.330.0050.02618.12
5.5.320.0250.04218.05
5.5.310.0130.03518.17
5.5.300.0020.04616.91
5.5.290.0050.02517.01
5.5.280.0080.04218.34
5.5.270.0000.02818.20
5.5.260.0080.04218.43
5.5.250.0130.04318.22
5.5.240.0050.04318.04
5.5.230.0070.01015.70
5.5.220.0060.00615.71
5.5.210.0080.00515.83
5.5.200.0070.00715.80
5.5.190.0000.01115.80
5.5.180.0120.00015.78
5.5.170.0070.01015.78
5.5.160.0030.01416.01
5.5.150.0000.01415.64
5.5.140.0060.00915.75
5.5.130.0060.00915.90
5.5.120.0000.01815.78
5.5.110.0030.01415.78
5.5.100.0060.00915.71
5.5.90.0030.00615.68
5.5.80.0120.00616.01
5.5.70.0040.01215.66
5.5.60.0030.01415.71
5.5.50.0040.00815.71
5.5.40.0000.01415.48
5.5.30.0040.00415.68
5.5.20.0000.01215.86
5.5.10.0040.01515.73
5.5.00.0070.00715.80
5.4.450.0150.02928.39
5.4.440.0220.02728.40
5.4.430.0300.01728.24
5.4.420.0190.01928.23
5.4.410.0130.02828.21
5.4.400.0180.01828.20
5.4.390.0100.02728.20
5.4.380.0050.02915.61
5.4.370.0070.02815.60
5.4.360.0050.02915.59
5.4.350.0060.03015.61
5.4.340.0070.02715.66
5.4.330.0040.00412.62
5.4.320.0070.02312.54
5.4.310.0040.02612.56
5.4.300.0070.01712.54
5.4.290.0060.02412.54
5.4.280.0040.02312.48
5.4.270.0040.02812.48
5.4.260.0080.02312.48
5.4.250.0060.02212.48
5.4.240.0030.02112.50
5.4.230.0020.02612.48
5.4.220.0040.02012.51
5.4.210.0050.01812.48
5.4.200.0020.02512.48
5.4.190.0040.02412.48
5.4.180.0090.01912.48
5.4.170.0060.02512.48
5.4.160.0080.02312.48
5.4.150.0090.02012.48
5.4.140.0040.02312.38
5.4.130.0050.02512.32
5.4.120.0040.02212.39
5.4.110.0070.02112.29
5.4.100.0090.02212.29
5.4.90.0060.02512.30
5.4.80.0080.01812.31
5.4.70.0060.02012.29
5.4.60.0080.02012.29
5.4.50.0060.02412.31
5.4.40.0040.02012.30
5.4.30.0050.02412.31
5.4.20.0020.02312.30
5.4.10.0070.02012.28
5.4.00.0060.02312.03
5.3.290.0060.02212.94
5.3.280.0050.02812.78
5.3.270.0060.02512.91
5.3.260.0080.02212.86
5.3.250.0090.01712.81
5.3.240.0070.01912.72
5.3.230.0030.02612.78
5.3.220.0020.02612.76
5.3.210.0060.02412.97
5.3.200.0020.02612.76
5.3.190.0020.02512.80
5.3.180.0080.02012.97
5.3.170.0070.02312.89
5.3.160.0050.02412.89
5.3.150.0060.02212.88
5.3.140.0040.02412.91
5.3.130.0030.02412.83
5.3.120.0050.02512.81
5.3.110.0060.02212.75
5.3.100.0060.02612.53
5.3.90.0070.02112.49
5.3.80.0020.02312.48
5.3.70.0050.02212.47
5.3.60.0040.02312.50
5.3.50.0040.02612.42
5.3.40.0040.02712.53
5.3.30.0040.02212.48
5.3.20.0050.01812.29
5.3.10.0050.01912.23
5.3.00.0040.02312.15
5.2.170.0030.0319.19
5.2.160.0060.0319.18
5.2.150.0060.0279.19
5.2.140.0030.0329.18
5.2.130.0050.0279.15
5.2.120.0070.0259.15
5.2.110.0080.0259.15
5.2.100.0050.0279.15
5.2.90.0050.0319.15
5.2.80.0040.0329.14
5.2.70.0060.0349.14
5.2.60.0030.0319.10
5.2.50.0080.0309.07
5.2.40.0030.0309.05
5.2.30.0080.0309.02
5.2.20.0070.0309.02
5.2.10.0060.0288.92
5.2.00.0060.0268.78
5.1.60.0040.0238.06
5.1.50.0030.0268.06
5.1.40.0010.0278.04
5.1.30.0050.0248.39
5.1.20.0030.0268.41
5.1.10.0050.0248.14
5.1.00.0060.0278.14
5.0.50.0020.0286.62
5.0.40.0020.0296.48
5.0.30.0050.0396.30
5.0.20.0030.0196.26
5.0.10.0090.0146.24
5.0.00.0060.0386.23
4.4.90.0020.0164.77
4.4.80.0030.0154.75
4.4.70.0040.0144.75
4.4.60.0040.0144.75
4.4.50.0030.0144.77
4.4.40.0010.0264.71
4.4.30.0020.0154.76
4.4.20.0040.0134.85
4.4.10.0020.0164.85
4.4.00.0050.0224.76
4.3.110.0020.0174.67
4.3.100.0020.0154.66
4.3.90.0030.0204.63
4.3.80.0030.0274.59
4.3.70.0020.0174.63
4.3.60.0030.0154.63
4.3.50.0030.0164.63
4.3.40.0030.0244.54
4.3.30.0030.0153.29
4.3.20.0030.0223.26
4.3.10.0020.0153.22
4.3.00.0030.01343.77

preferences:
41.22 ms | 401 KiB | 5 Q