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]+)', $test2, $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.0170.00316.63
8.3.50.0060.01122.18
8.3.40.0060.00918.95
8.3.30.0000.01419.12
8.3.20.0080.00020.37
8.3.10.0080.00023.61
8.3.00.0040.00419.56
8.2.180.0130.01018.54
8.2.170.0090.00622.96
8.2.160.0140.00020.45
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0060.00926.16
8.2.120.0040.00419.89
8.2.110.0090.00022.24
8.2.100.0040.00817.91
8.2.90.0050.00319.36
8.2.80.0030.00517.97
8.2.70.0030.00517.75
8.2.60.0000.00817.93
8.2.50.0080.00018.07
8.2.40.0100.00219.70
8.2.30.0000.00818.39
8.2.20.0000.00817.85
8.2.10.0040.00418.13
8.2.00.0000.00818.00
8.1.280.0070.01425.92
8.1.270.0000.00922.03
8.1.260.0000.00726.35
8.1.250.0000.00728.09
8.1.240.0060.00323.76
8.1.230.0080.00319.15
8.1.220.0050.00317.75
8.1.210.0050.00318.77
8.1.200.0030.00617.25
8.1.190.0030.00617.47
8.1.180.0050.00318.10
8.1.170.0050.00318.59
8.1.160.0040.00422.10
8.1.150.0000.00818.74
8.1.140.0040.00417.52
8.1.130.0050.00217.77
8.1.120.0040.00417.50
8.1.110.0030.00617.50
8.1.100.0040.00417.66
8.1.90.0000.00717.49
8.1.80.0000.00717.67
8.1.70.0030.00317.57
8.1.60.0040.00417.72
8.1.50.0060.00317.53
8.1.40.0040.00417.57
8.1.30.0030.00617.72
8.1.20.0080.00017.85
8.1.10.0050.00317.74
8.1.00.0030.00517.75
8.0.300.0000.00718.77
8.0.290.0040.00416.75
8.0.280.0030.00318.46
8.0.270.0000.00717.27
8.0.260.0000.00817.28
8.0.250.0080.00017.08
8.0.240.0070.00017.10
8.0.230.0000.00717.08
8.0.220.0030.00316.92
8.0.210.0030.00317.00
8.0.200.0000.00617.13
8.0.190.0050.00317.03
8.0.180.0040.00416.96
8.0.170.0030.00516.91
8.0.160.0020.00517.01
8.0.150.0080.00017.05
8.0.140.0040.00416.90
8.0.130.0000.00513.46
8.0.120.0080.00017.07
8.0.110.0050.00316.93
8.0.100.0040.00417.05
8.0.90.0040.00417.11
8.0.80.0050.01016.96
8.0.70.0020.00516.88
8.0.60.0030.00617.08
8.0.50.0000.00717.10
8.0.30.0100.01517.30
8.0.20.0130.00717.40
8.0.10.0040.00417.05
8.0.00.0070.01416.82
7.4.330.0030.00315.02
7.4.320.0000.00616.82
7.4.300.0030.00316.80
7.4.290.0070.00016.73
7.4.280.0040.00416.62
7.4.270.0040.00416.82
7.4.260.0110.00016.70
7.4.250.0080.00016.73
7.4.240.0040.00316.80
7.4.230.0030.00316.90
7.4.220.0090.00916.70
7.4.210.0030.01216.82
7.4.200.0000.00716.88
7.4.160.0090.01516.75
7.4.150.0090.00917.40
7.4.140.0120.00817.86
7.4.130.0080.01016.60
7.4.120.0080.00816.68
7.4.110.0040.01316.70
7.4.100.0070.01016.66
7.4.90.0140.00816.71
7.4.80.0030.02019.39
7.4.70.0030.01316.46
7.4.60.0060.01116.90
7.4.50.0000.00416.57
7.4.40.0170.00016.81
7.4.30.0060.01016.71
7.4.10.0100.00815.12
7.4.00.0070.01115.18
7.3.330.0050.00013.14
7.3.320.0030.00313.19
7.3.310.0040.00416.30
7.3.300.0040.00416.44
7.3.290.0140.00316.45
7.3.280.0110.00916.44
7.3.270.0090.01017.40
7.3.260.0120.00816.57
7.3.250.0100.01016.66
7.3.240.0030.01416.63
7.3.230.0060.01116.51
7.3.210.0070.01016.48
7.3.200.0110.00619.39
7.3.190.0140.00716.79
7.3.180.0100.00616.62
7.3.170.0150.00416.78
7.3.160.0060.00916.59
7.3.130.0070.01115.09
7.3.120.0100.00815.09
7.3.110.0120.00614.99
7.3.100.0050.00915.09
7.3.90.0090.00715.02
7.3.80.0080.00515.15
7.3.70.0060.00714.94
7.3.60.0070.00614.96
7.3.50.0060.00614.81
7.3.40.0070.00514.97
7.3.30.0080.00714.97
7.3.20.0020.01216.61
7.3.10.0020.01016.74
7.3.00.0070.00716.82
7.2.330.0120.00616.69
7.2.320.0100.01017.03
7.2.310.0080.01216.75
7.2.300.0030.01316.71
7.2.290.0060.01016.93
7.2.260.0090.00415.24
7.2.250.0090.00915.20
7.2.240.0070.00715.21
7.2.230.0090.00815.29
7.2.220.0090.00715.23
7.2.210.0040.01215.07
7.2.200.0070.00715.06
7.2.190.0050.00815.13
7.2.180.0040.00715.13
7.2.170.0050.01115.35
7.2.160.0060.00615.17
7.2.150.0020.01116.84
7.2.140.0040.00816.95
7.2.130.0060.01117.03
7.2.120.0040.01117.10
7.2.110.0070.00517.05
7.2.100.0070.00916.96
7.2.90.0120.00417.22
7.2.80.0070.00916.91
7.2.70.0060.00717.19
7.2.60.0050.00917.21
7.2.50.0050.01117.08
7.2.40.0030.01416.98
7.2.30.0030.01317.01
7.2.20.0100.00217.04
7.2.10.0050.00817.15
7.2.00.0060.00817.90
7.1.330.0050.01015.75
7.1.320.0070.00416.01
7.1.310.0040.00715.85
7.1.300.0050.00615.88
7.1.290.0040.00915.85
7.1.280.0000.01315.94
7.1.270.0050.00816.13
7.1.260.0080.00315.89
7.1.250.0070.00516.04
7.1.240.0060.00715.74
7.1.230.0050.00916.04
7.1.220.0090.00615.70
7.1.210.0050.00915.72
7.1.200.0060.00716.03
7.1.190.0080.00515.85
7.1.180.0020.01216.00
7.1.170.0060.00615.85
7.1.160.0030.00816.14
7.1.150.0100.00516.03
7.1.140.0070.00815.99
7.1.130.0030.01015.75
7.1.120.0090.00115.96
7.1.110.0030.01216.01
7.1.100.0050.00816.89
7.1.90.0050.00716.05
7.1.80.0040.00716.00
7.1.70.0060.00716.47
7.1.60.0050.00716.46
7.1.50.0060.01016.40
7.1.40.0070.00815.96
7.1.30.0030.00815.83
7.1.20.0050.00715.83
7.1.10.0090.00715.83
7.1.00.0030.03418.02
7.0.330.0020.00715.47
7.0.320.0070.00815.49
7.0.310.0070.00715.50
7.0.300.0030.00515.55
7.0.290.0060.00815.51
7.0.280.0050.01015.62
7.0.270.0040.00815.61
7.0.260.0060.00615.62
7.0.250.0080.00615.58
7.0.240.0050.00815.57
7.0.230.0040.00915.73
7.0.220.0040.00715.66
7.0.210.0050.00815.55
7.0.200.0030.01116.13
7.0.190.0050.00915.48
7.0.180.0060.00715.46
7.0.170.0050.00915.47
7.0.160.0050.00415.57
7.0.150.0100.00515.58
7.0.140.0040.03017.66
7.0.130.0010.01015.45
7.0.120.0060.00815.35
7.0.110.0090.00515.52
7.0.100.0110.00315.64
7.0.90.0070.00315.72
7.0.80.0070.00715.49
7.0.70.0080.00515.72
7.0.60.0080.03217.20
7.0.50.0050.01716.34
7.0.40.0080.03315.89
7.0.30.0070.02215.81
7.0.20.0140.01715.75
7.0.10.0130.02615.61
7.0.00.0020.02515.79
5.6.400.0030.00914.45
5.6.390.0070.00914.56
5.6.380.0100.00514.34
5.6.370.0030.00814.31
5.6.360.0030.01214.49
5.6.350.0020.01014.48
5.6.340.0040.00914.73
5.6.330.0040.01114.52
5.6.320.0050.00714.63
5.6.310.0030.00814.73
5.6.300.0080.00514.70
5.6.290.0030.00614.37
5.6.280.0050.02816.49
5.6.270.0100.00614.38
5.6.260.0060.00814.33
5.6.250.0080.00414.47
5.6.240.0070.00414.37
5.6.230.0060.00714.45
5.6.220.0020.01214.37
5.6.210.0060.02216.46
5.6.200.0070.02915.67
5.6.190.0120.02716.39
5.6.180.0180.01916.40
5.6.170.0160.01916.50
5.6.160.0100.02816.53
5.6.150.0070.02315.68
5.6.140.0070.01715.75
5.6.130.0020.02615.67
5.6.120.0070.02516.73
5.6.110.0100.02616.66
5.6.100.0040.03316.62
5.6.90.0050.03416.75
5.6.80.0090.01416.36
5.6.70.1300.01816.34
5.6.60.0070.00314.37
5.6.50.0060.00614.46
5.6.40.0070.00414.52
5.6.30.0060.00414.46
5.6.20.0030.00814.45
5.6.10.0050.00614.37
5.6.00.0070.00714.12
5.5.380.0050.00914.26
5.5.370.0030.01014.58
5.5.360.0000.01214.15
5.5.350.0050.02916.37
5.5.340.0050.03515.74
5.5.330.0030.03616.47
5.5.320.0090.02316.24
5.5.310.0150.02816.46
5.5.300.0060.01715.56
5.5.290.0060.02915.52
5.5.280.0050.02116.54
5.5.270.0080.03016.42
5.5.260.0100.01816.51
5.5.250.0080.02616.33
5.5.240.0060.01716.30
5.5.230.0090.00414.27
5.5.220.0030.00814.35
5.5.210.0050.00714.15
5.5.200.0070.00814.18
5.5.190.0040.00914.52
5.5.180.0030.00814.32
5.5.170.0050.01114.42
5.5.160.0080.00514.30
5.5.150.0020.01014.07
5.5.140.0030.01014.38
5.5.130.0030.00814.09
5.5.120.0030.01214.13
5.5.110.0050.01014.24
5.5.100.0000.01414.43
5.5.90.0060.00514.32
5.5.80.0030.01214.52
5.5.70.0060.00914.32
5.5.60.0070.00414.22
5.5.50.0030.01014.36
5.5.40.0080.00714.33
5.5.30.0040.00914.39
5.5.20.0060.00814.25
5.5.10.0070.00514.50
5.5.00.0050.00714.29
5.4.450.0130.01622.11
5.4.440.0210.01322.08
5.4.430.0140.01722.04
5.4.420.0230.01722.01
5.4.410.0030.01913.91
5.4.400.0110.01521.88
5.4.390.0140.01422.06
5.4.380.0060.02213.48
5.4.370.0060.02313.54
5.4.360.0090.02013.54
5.4.350.0070.02213.70
5.4.340.0040.02513.60
5.4.330.0020.00811.15
5.4.320.0060.01611.50
5.4.310.0040.02011.44
5.4.300.0050.01611.54
5.4.290.0040.01611.56
5.4.280.0040.01611.46
5.4.270.0060.01511.53
5.4.260.0050.01611.45
5.4.250.0050.01711.61
5.4.240.0010.02011.48
5.4.230.0050.01611.38
5.4.220.0060.01411.44
5.4.210.0070.01411.46
5.4.200.0090.01311.51
5.4.190.0040.01611.58
5.4.180.0080.01311.53
5.4.170.0050.01711.55
5.4.160.0020.01811.47
5.4.150.0060.01611.45
5.4.140.0050.01811.40
5.4.130.0060.01611.38
5.4.120.0040.01611.36
5.4.110.0040.01811.28
5.4.100.0030.01711.43
5.4.90.0040.01811.30
5.4.80.0030.01911.28
5.4.70.0060.01711.35
5.4.60.0040.01611.47
5.4.50.0040.01411.33
5.4.40.0040.01711.31
5.4.30.0040.01711.45
5.4.20.0050.01711.30
5.4.10.0070.01311.43
5.4.00.0030.01611.12
5.3.290.0050.01511.25
5.3.280.0050.01511.17
5.3.270.0020.01711.25
5.3.260.0040.01511.23
5.3.250.0050.01611.31
5.3.240.0040.01811.19
5.3.230.0040.02111.27
5.3.220.0060.01511.08
5.3.210.0050.01611.20
5.3.200.0040.01811.26
5.3.190.0030.01711.23
5.3.180.0050.01811.22
5.3.170.0060.01911.34
5.3.160.0040.01711.27
5.3.150.0040.01711.27
5.3.140.0040.01811.32
5.3.130.0060.01511.19
5.3.120.0060.01511.20
5.3.110.0060.01611.22
5.3.100.0060.01511.07
5.3.90.0040.01511.09
5.3.80.0030.01710.97
5.3.70.0070.01410.93
5.3.60.0040.01711.08
5.3.50.0050.01610.90
5.3.40.0030.01910.98
5.3.30.0040.01610.94
5.3.20.0050.01610.93
5.3.10.0070.01410.69
5.3.00.0050.01610.69
5.2.170.0060.0299.20
5.2.160.0030.0329.19
5.2.150.0050.0379.19
5.2.140.0050.0309.19
5.2.130.0060.0399.15
5.2.120.0040.0289.15
5.2.110.0040.0309.16
5.2.100.0020.0319.15
5.2.90.0050.0359.15
5.2.80.0080.0369.14
5.2.70.0070.0319.15
5.2.60.0050.0299.10
5.2.50.0060.0289.07
5.2.40.0030.0369.05
5.2.30.0050.0299.02
5.2.20.0070.0259.02
5.2.10.0080.0278.92
5.2.00.0070.0378.79
5.1.60.0040.0248.07
5.1.50.0050.0288.07
5.1.40.0070.0258.04
5.1.30.0040.0308.39
5.1.20.0050.0268.41
5.1.10.0040.0268.14
5.1.00.0060.0238.14
5.0.50.0040.0206.63
5.0.40.0000.0236.49
5.0.30.0020.0336.30
5.0.20.0020.0206.27
5.0.10.0040.0196.25
5.0.00.0030.0306.24
4.4.90.0040.0224.78
4.4.80.0030.0144.75
4.4.70.0030.0154.75
4.4.60.0030.0154.75
4.4.50.0050.0124.77
4.4.40.0040.0304.71
4.4.30.0020.0224.76
4.4.20.0030.0194.84
4.4.10.0030.0184.85
4.4.00.0030.0274.76
4.3.110.0030.0204.67
4.3.100.0050.0134.66
4.3.90.0030.0214.63
4.3.80.0070.0274.58
4.3.70.0020.0204.63
4.3.60.0020.0154.63
4.3.50.0040.0154.63
4.3.40.0040.0234.54
4.3.30.0050.0173.29
4.3.20.0010.0173.27
4.3.10.0000.0173.23
4.3.00.0070.01343.79

preferences:
51.22 ms | 401 KiB | 5 Q