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); } 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.70.0110.00718.43
8.3.60.0140.00716.75
8.3.50.0140.00522.11
8.3.40.0070.01118.91
8.3.30.0180.00019.09
8.3.20.0040.00420.34
8.3.10.0040.00423.64
8.3.00.0000.00819.79
8.2.180.0130.00918.54
8.2.170.0180.00322.96
8.2.160.0140.00020.38
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0130.00921.02
8.2.110.0050.00522.02
8.2.100.0060.00618.03
8.2.90.0060.00319.36
8.2.80.0040.00417.97
8.2.70.0060.00317.88
8.2.60.0090.00018.05
8.2.50.0090.00018.07
8.2.40.0040.00419.86
8.2.30.0000.00718.28
8.2.20.0000.00717.83
8.2.10.0070.00018.22
8.2.00.0050.00317.90
8.1.280.0120.00625.92
8.1.270.0060.00322.18
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0090.00023.71
8.1.230.0080.00319.16
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0050.00517.48
8.1.190.0040.00417.36
8.1.180.0000.00918.10
8.1.170.0000.00818.74
8.1.160.0080.00021.96
8.1.150.0040.00418.82
8.1.140.0000.00817.60
8.1.130.0030.00317.80
8.1.120.0000.00717.51
8.1.110.0020.00517.53
8.1.100.0040.00417.48
8.1.90.0040.00417.57
8.1.80.0000.00717.64
8.1.70.0030.00317.58
8.1.60.0080.00017.74
8.1.50.0000.00917.57
8.1.40.0030.00617.72
8.1.30.0040.00417.81
8.1.20.0000.00917.70
8.1.10.0050.00317.72
8.1.00.0040.00417.63
8.0.300.0030.00318.77
8.0.290.0000.00816.88
8.0.280.0030.00318.40
8.0.270.0000.00717.28
8.0.260.0000.00717.29
8.0.250.0030.00317.09
8.0.240.0030.00317.10
8.0.230.0000.00717.12
8.0.220.0000.00716.94
8.0.210.0000.00717.08
8.0.200.0000.00617.05
8.0.190.0040.00417.09
8.0.180.0000.00717.06
8.0.170.0030.00517.10
8.0.160.0000.00717.04
8.0.150.0000.00816.96
8.0.140.0040.00416.97
8.0.130.0000.00613.45
8.0.120.0000.00916.99
8.0.110.0060.00316.86
8.0.100.0040.00417.04
8.0.90.0080.00017.04
8.0.80.0060.01617.03
8.0.70.0050.00317.07
8.0.60.0030.00516.99
8.0.50.0000.00716.98
8.0.30.0110.00917.39
8.0.20.0140.00617.40
8.0.10.0070.00017.18
8.0.00.0100.01016.93
7.4.330.0060.00015.14
7.4.320.0030.00316.58
7.4.300.0000.00616.63
7.4.290.0020.00516.83
7.4.280.0030.00316.71
7.4.270.0030.00516.66
7.4.260.0000.00716.75
7.4.250.0000.00716.59
7.4.240.0050.00216.76
7.4.230.0030.00316.82
7.4.220.0040.01816.88
7.4.210.0120.00316.67
7.4.200.0050.00316.79
7.4.160.0060.01216.60
7.4.150.0120.00617.40
7.4.140.0100.00817.86
7.4.130.0130.00516.64
7.4.120.0120.00416.85
7.4.110.0130.01016.86
7.4.100.0060.01216.77
7.4.90.0100.00716.64
7.4.80.0100.01019.39
7.4.70.0120.00416.71
7.4.60.0030.01316.66
7.4.50.0030.00316.53
7.4.40.0080.00816.56
7.4.30.0090.00616.77
7.4.00.0090.00714.94
7.3.330.0030.00313.34
7.3.320.0030.00313.31
7.3.310.0070.00016.23
7.3.300.0030.00316.41
7.3.290.0050.01116.44
7.3.280.0090.00616.41
7.3.270.0100.00717.40
7.3.260.0130.01016.52
7.3.250.0120.00916.64
7.3.240.0130.01016.42
7.3.230.0130.00316.70
7.3.210.0070.01016.54
7.3.200.0100.00619.39
7.3.190.0060.01216.67
7.3.180.0090.00916.48
7.3.170.0100.00616.63
7.3.160.0120.00316.60
7.3.120.0100.00814.99
7.3.110.0160.00314.58
7.3.100.0090.00914.79
7.3.90.0120.00314.94
7.3.80.0090.00914.90
7.3.70.0110.00314.85
7.3.60.0070.00715.16
7.3.50.0060.00315.02
7.3.40.0060.00914.78
7.3.30.0070.00714.89
7.3.20.0100.00316.84
7.3.10.0070.00516.82
7.3.00.0060.00616.85
7.2.330.0070.01016.78
7.2.320.0110.00616.92
7.2.310.0110.00616.91
7.2.300.0070.01016.78
7.2.290.0130.00316.67
7.2.250.0000.01815.20
7.2.240.0090.00614.86
7.2.230.0070.00715.07
7.2.220.0070.01315.11
7.2.210.0100.00315.16
7.2.200.0040.00415.11
7.2.190.0130.00315.14
7.2.180.0070.00715.40
7.2.170.0060.00315.17
7.2.160.0060.00915.36
7.2.150.0060.00616.87
7.2.140.0030.01017.24
7.2.130.0090.00616.97
7.2.120.0060.00817.04
7.2.110.0040.00816.96
7.2.100.0050.01017.12
7.2.90.0040.01017.00
7.2.80.0050.01017.01
7.2.70.0050.00917.11
7.2.60.0080.00616.97
7.2.50.0060.00717.22
7.2.40.0080.00616.93
7.2.30.0040.01117.08
7.2.20.0050.01017.01
7.2.10.0050.00717.02
7.2.00.0050.00817.77
7.1.330.0070.01016.02
7.1.320.0040.01516.01
7.1.310.0070.00716.19
7.1.300.0000.01615.95
7.1.290.0040.00715.87
7.1.280.0070.00315.99
7.1.270.0030.00916.04
7.1.260.0000.01215.62
7.1.250.0070.00515.92
7.1.240.0080.00816.12
7.1.230.0040.00416.10
7.1.220.0060.00916.02
7.1.210.0070.01015.69
7.1.200.0090.00716.05
7.1.190.0100.00316.06
7.1.180.0000.01516.06
7.1.170.0090.00616.17
7.1.160.0100.00316.05
7.1.150.0040.01115.97
7.1.140.0040.00815.89
7.1.130.0000.01215.91
7.1.120.0070.00415.86
7.1.110.0030.00915.80
7.1.100.0050.00717.10
7.1.90.0040.01116.03
7.1.80.0060.00616.19
7.1.70.0030.00616.79
7.1.60.0080.00717.91
7.1.50.0050.01116.52
7.1.40.0000.01116.00
7.1.30.0090.00015.98
7.1.20.0050.00316.09
7.1.10.0000.01115.72
7.1.00.0030.04319.26
7.0.330.0100.00615.66
7.0.320.0090.00315.64
7.0.310.0100.00715.73
7.0.300.0070.00715.77
7.0.290.0030.01015.79
7.0.280.0070.00715.60
7.0.270.0090.00015.50
7.0.260.0080.00315.79
7.0.250.0030.00615.46
7.0.240.0090.00315.65
7.0.230.0100.00015.71
7.0.220.0080.00315.54
7.0.210.0060.00315.75
7.0.200.0030.00916.23
7.0.190.0060.00315.59
7.0.180.0060.00615.64
7.0.170.0000.01115.62
7.0.160.0030.00615.41
7.0.150.0040.00815.38
7.0.140.0030.04218.81
7.0.130.0040.00715.73
7.0.120.0030.00915.55
7.0.110.0070.00715.72
7.0.100.0000.01515.61
7.0.90.0100.00315.66
7.0.80.0080.00315.62
7.0.70.0090.00615.66
7.0.60.0050.04517.73
7.0.50.0020.04816.69
7.0.40.0060.04016.92
7.0.30.0220.01516.93
7.0.20.0150.03216.78
7.0.10.0070.02716.88
7.0.00.0140.02516.84
5.6.400.0080.00814.61
5.6.390.0050.00514.61
5.6.380.0060.00914.60
5.6.370.0150.00314.84
5.6.360.0080.01214.45
5.6.350.0080.00414.32
5.6.340.0070.01114.18
5.6.330.0000.00914.62
5.6.320.0030.01014.63
5.6.310.0000.00914.78
5.6.300.0030.00914.14
5.6.290.0000.00814.22
5.6.280.0050.03917.89
5.6.270.0000.01414.68
5.6.260.0080.00614.45
5.6.250.0040.01214.50
5.6.240.0070.00314.34
5.6.230.0030.00914.44
5.6.220.0100.00714.53
5.6.210.0070.04217.45
5.6.200.0030.02716.27
5.6.190.0130.04317.49
5.6.180.0100.02717.34
5.6.170.0180.02617.37
5.6.160.0050.03517.48
5.6.150.0100.03216.23
5.6.140.0030.02616.37
5.6.130.0030.04216.27
5.6.120.0070.03817.93
5.6.110.0020.03017.55
5.6.100.0100.04217.66
5.6.90.0030.02717.62
5.6.80.0050.04217.46
5.6.70.0030.00714.55
5.6.60.0060.00614.34
5.6.50.0040.00414.28
5.6.40.0030.01114.41
5.6.30.0000.01314.38
5.6.20.0140.00014.50
5.6.10.0030.01014.25
5.6.00.0040.00714.49
5.5.380.0090.00314.29
5.5.370.0100.00314.71
5.5.360.0030.01014.12
5.5.350.0130.04017.24
5.5.340.0110.03916.23
5.5.330.0030.04917.35
5.5.320.0220.02917.22
5.5.310.0210.02817.12
5.5.300.0020.02516.15
5.5.290.0090.02716.09
5.5.280.0070.02317.63
5.5.270.0090.03517.63
5.5.260.0050.05017.41
5.5.250.0060.02417.56
5.5.240.0020.03717.13
5.5.230.0090.00914.30
5.5.220.0030.00514.15
5.5.210.0060.00314.52
5.5.200.0040.01214.16
5.5.190.0070.00414.37
5.5.180.0030.01414.50
5.5.170.0070.00714.51
5.5.160.0000.00914.19
5.5.150.0000.01114.39
5.5.140.0040.01114.16
5.5.130.0060.00614.29
5.5.120.0030.00914.27
5.5.110.0000.01414.34
5.5.100.0030.01214.27
5.5.90.0030.00614.07
5.5.80.0000.01614.40
5.5.70.0140.00014.47
5.5.60.0060.01014.25
5.5.50.0150.00014.32
5.5.40.0090.00914.48
5.5.30.0060.00614.46
5.5.20.0000.01114.27
5.5.10.0090.00614.23
5.5.00.0080.00414.52
5.4.450.0070.02927.87
5.4.440.0150.03027.86
5.4.430.0260.02327.85
5.4.420.0280.02327.85
5.4.410.0190.02027.84
5.4.400.0160.01827.83
5.4.390.0100.02627.80
5.4.380.0080.03015.16
5.4.370.0120.02315.25
5.4.360.0050.03915.21
5.4.350.0050.03215.21
5.4.340.0050.03515.13
5.4.330.0060.00611.80
5.4.320.0050.02612.13
5.4.310.0050.02612.13
5.4.300.0060.02012.13
5.4.290.0060.02012.13
5.4.280.0020.02212.07
5.4.270.0020.02312.08
5.4.260.0060.02112.07
5.4.250.0040.02412.07
5.4.240.0040.02212.07
5.4.230.0040.02612.07
5.4.220.0050.02212.07
5.4.210.0070.02612.07
5.4.200.0040.02212.07
5.4.190.0040.02512.07
5.4.180.0040.02212.07
5.4.170.0040.02212.07
5.4.160.0070.01912.07
5.4.150.0040.01912.07
5.4.140.0040.02011.91
5.4.130.0050.02311.91
5.4.120.0040.02611.89
5.4.110.0040.02611.88
5.4.100.0100.01911.88
5.4.90.0060.02611.88
5.4.80.0060.02311.88
5.4.70.0070.01911.88
5.4.60.0030.02411.88
5.4.50.0080.02211.88
5.4.40.0080.02111.88
5.4.30.0070.02011.88
5.4.20.0040.02211.88
5.4.10.0060.02411.88
5.4.00.0050.02111.62
5.3.290.0060.02612.30
5.3.280.0070.02312.25
5.3.270.0080.02312.26
5.3.260.0040.02612.26
5.3.250.0050.02212.26
5.3.240.0060.02012.26
5.3.230.0050.02212.25
5.3.220.0060.02412.24
5.3.210.0050.02212.24
5.3.200.0060.02112.24
5.3.190.0040.02412.24
5.3.180.0050.02112.24
5.3.170.0070.02212.24
5.3.160.0070.02312.24
5.3.150.0050.02312.23
5.3.140.0080.02012.23
5.3.130.0020.02512.23
5.3.120.0010.02812.23
5.3.110.0040.02812.23
5.3.100.0030.02211.96
5.3.90.0040.02311.94
5.3.80.0060.01911.94
5.3.70.0070.02411.94
5.3.60.0030.02211.93
5.3.50.0050.02011.90
5.3.40.0030.02211.90
5.3.30.0070.02011.88
5.3.20.0070.02111.77
5.3.10.0040.02111.75
5.3.00.0060.02511.74
5.2.170.0040.0329.19
5.2.160.0080.0269.19
5.2.150.0030.0319.19
5.2.140.0040.0309.19
5.2.130.0010.0319.15
5.2.120.0070.0289.15
5.2.110.0040.0319.16
5.2.100.0070.0269.15
5.2.90.0070.0269.15
5.2.80.0110.0329.14
5.2.70.0040.0309.15
5.2.60.0050.0289.10
5.2.50.0060.0279.06
5.2.40.0040.0369.05
5.2.30.0060.0289.03
5.2.20.0070.0319.01
5.2.10.0050.0278.92
5.2.00.0020.0308.79
5.1.60.0020.0268.07
5.1.50.0020.0278.07
5.1.40.0040.0248.04
5.1.30.0050.0258.39
5.1.20.0050.0258.41
5.1.10.0020.0278.14
5.1.00.0040.0288.14
5.0.50.0040.0196.63
5.0.40.0030.0206.49
5.0.30.0050.0466.30
5.0.20.0030.0206.27
5.0.10.0020.0216.25
5.0.00.0020.0326.24
4.4.90.0040.0144.78
4.4.80.0030.0154.75
4.4.70.0010.0174.76
4.4.60.0010.0184.76
4.4.50.0040.0144.77
4.4.40.0010.0264.71
4.4.30.0020.0164.75
4.4.20.0010.0174.84
4.4.10.0010.0174.85
4.4.00.0060.0214.76
4.3.110.0020.0174.67
4.3.100.0040.0144.66
4.3.90.0010.0164.63
4.3.80.0050.0224.58
4.3.70.0030.0144.63
4.3.60.0040.0134.63
4.3.50.0020.0164.63
4.3.40.0030.0244.53
4.3.30.0030.0153.30
4.3.20.0020.0163.27
4.3.10.0020.0163.23
4.3.00.0030.01743.79

preferences:
34.12 ms | 401 KiB | 5 Q