3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = ['07511 111111', '+447511 111111', '+44 (0) 7511 111111', '07211 111111', '3749853857', '0712121211233', 'abcd', '07468777774']; 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.0180.00016.48
8.3.50.0070.01018.18
8.3.40.0120.00618.96
8.3.30.0110.00419.27
8.3.20.0040.00420.16
8.3.10.0090.00023.64
8.3.00.0060.00319.69
8.2.180.0090.00616.63
8.2.170.0110.00322.96
8.2.160.0100.00322.13
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00321.04
8.2.110.0040.00822.10
8.2.100.0000.01118.16
8.2.90.0000.00919.35
8.2.80.0000.00817.97
8.2.70.0030.00617.73
8.2.60.0060.00318.05
8.2.50.0080.00018.07
8.2.40.0040.00418.05
8.2.30.0000.00718.25
8.2.20.0080.00017.80
8.2.10.0050.00318.30
8.2.00.0040.00417.93
8.1.270.0100.00023.87
8.1.260.0030.00526.35
8.1.250.0050.00328.09
8.1.240.0060.00323.91
8.1.230.0070.00419.09
8.1.220.0080.00417.74
8.1.210.0000.00818.77
8.1.200.0000.00917.48
8.1.190.0080.00017.35
8.1.180.0080.00018.10
8.1.170.0060.00318.71
8.1.160.0040.00421.98
8.1.150.0000.00718.68
8.1.140.0000.00717.62
8.1.130.0030.00317.93
8.1.120.0070.00017.64
8.1.110.0040.00417.52
8.1.100.0040.00417.65
8.1.90.0000.00717.66
8.1.80.0040.00417.63
8.1.70.0080.00017.52
8.1.60.0060.00317.75
8.1.50.0030.00517.70
8.1.40.0030.00617.61
8.1.30.0000.00817.66
8.1.20.0000.00817.74
8.1.10.0050.00217.70
8.1.00.0060.00317.63
8.0.300.0000.00818.77
8.0.290.0040.00416.88
8.0.280.0000.00718.55
8.0.270.0000.00717.18
8.0.260.0060.00017.21
8.0.250.0000.00817.03
8.0.240.0070.00017.02
8.0.230.0030.00617.09
8.0.220.0030.00317.02
8.0.210.0000.00717.08
8.0.200.0000.00617.13
8.0.190.0060.00317.15
8.0.180.0000.00816.93
8.0.170.0000.00717.07
8.0.160.0040.00416.95
8.0.150.0040.00416.85
8.0.140.0040.00816.99
8.0.130.0000.00513.46
8.0.120.0080.00017.04
8.0.110.0000.00817.06
8.0.100.0040.00416.95
8.0.90.0000.00816.95
8.0.80.0130.01017.01
8.0.70.0080.00017.13
8.0.60.0060.00317.14
8.0.50.0040.00417.09
8.0.30.0080.01117.31
8.0.20.0110.01417.51
8.0.10.0000.00717.04
8.0.00.0050.01616.82
7.4.330.0050.00015.16
7.4.320.0040.00416.85
7.4.300.0030.00316.84
7.4.290.0070.00016.79
7.4.280.0040.00416.73
7.4.270.0030.00316.73
7.4.260.0030.00616.71
7.4.250.0040.00416.63
7.4.240.0000.00716.85
7.4.230.0040.00416.63
7.4.220.0180.00016.71
7.4.210.0100.00316.86
7.4.200.0000.00716.87
7.4.160.0070.01016.76
7.4.150.0090.00917.40
7.4.140.0120.00717.86
7.4.130.0110.00616.92
7.4.120.0090.00816.61
7.4.110.0070.01116.98
7.4.100.0100.00716.73
7.4.90.0000.01716.70
7.4.80.0120.00919.39
7.4.70.0160.00616.78
7.4.60.0080.00816.71
7.4.50.0060.00316.32
7.4.40.0140.00416.62
7.4.30.0100.00616.79
7.4.00.0130.00315.19
7.3.330.0030.00313.23
7.3.320.0000.00613.22
7.3.310.0070.00016.56
7.3.300.0000.00716.42
7.3.290.0030.01716.45
7.3.280.0110.00916.55
7.3.270.0130.00317.40
7.3.260.0150.00416.80
7.3.250.0090.01016.57
7.3.240.0090.00916.82
7.3.230.0140.00316.80
7.3.210.0110.00716.63
7.3.200.0090.00619.39
7.3.190.0110.01116.57
7.3.180.0120.00416.62
7.3.170.0040.01116.55
7.3.160.0060.00916.90
7.3.120.0080.00815.18
7.3.10.0100.00316.89
7.3.00.0060.00716.78
7.2.330.0070.01016.83
7.2.320.0140.00316.68
7.2.310.0090.00616.83
7.2.300.0030.01316.99
7.2.290.0150.00316.77
7.2.130.0080.00817.19
7.2.120.0050.01116.82
7.2.110.0090.00716.97
7.2.100.0030.01216.94
7.2.90.0040.01317.09
7.2.80.0060.01116.92
7.2.70.0060.01316.90
7.2.60.0100.00917.14
7.2.50.0150.00517.06
7.2.40.0020.01316.98
7.2.30.0080.01016.95
7.2.20.0090.00416.92
7.2.10.0060.01017.20
7.2.00.0130.00718.03
7.1.250.0100.00615.91
7.1.240.0140.00316.05
7.1.230.0060.00815.69
7.1.220.0110.01115.92
7.1.210.0110.00016.02
7.1.200.0110.00915.91
7.1.190.0130.01315.97
7.1.180.0100.00715.70
7.1.170.0040.01115.63
7.1.160.0060.00615.71
7.1.150.0170.00015.64
7.1.140.0160.00615.67
7.1.130.0030.01016.02
7.1.120.0190.00415.88
7.1.110.0140.00715.77
7.1.100.0110.00917.15
7.1.90.0050.01016.00
7.1.80.0110.00615.64
7.1.70.0020.00816.61
7.1.60.0150.00717.63
7.1.50.0160.00516.49
7.1.40.0200.00016.06
7.1.30.0130.00815.73
7.1.20.0080.01215.83
7.1.10.0060.01415.72
7.1.00.0110.04119.02
7.0.330.0000.01115.32
7.0.320.0030.01015.41
7.0.310.0180.00315.64
7.0.300.0040.00715.36
7.0.290.0070.00715.36
7.0.280.0060.01215.51
7.0.270.0040.01115.54
7.0.260.0160.00015.35
7.0.250.0030.01015.57
7.0.240.0040.01515.44
7.0.230.0150.00415.73
7.0.220.0160.00715.53
7.0.210.0030.00815.11
7.0.200.0080.00816.24
7.0.190.0100.00715.15
7.0.180.0030.01415.45
7.0.170.0040.01115.77
7.0.160.0090.00615.28
7.0.150.0030.01415.68
7.0.140.0030.04518.69
7.0.130.0230.00015.57
7.0.120.0000.01815.56
7.0.110.0150.03817.74
7.0.100.0090.04617.77
7.0.90.0130.02717.77
7.0.80.0140.03917.74
7.0.70.0100.02417.75
7.0.60.0090.02217.83
7.0.50.0140.04017.52
7.0.40.0150.03716.62
7.0.30.0090.03316.62
7.0.20.0090.03216.66
7.0.10.0100.04216.60
7.0.00.0100.04316.65
5.6.380.0040.00714.49
5.6.370.0100.00714.16
5.6.360.0000.01514.04
5.6.350.0090.00614.52
5.6.340.0150.00914.33
5.6.330.0110.00314.59
5.6.320.0100.00714.13
5.6.310.0180.00014.46
5.6.300.0070.01314.46
5.6.290.0040.01114.48
5.6.280.0040.04217.73
5.6.270.0130.00314.14
5.6.260.0170.04317.39
5.6.250.0090.04017.50
5.6.240.0090.02917.38
5.6.230.0120.03317.38
5.6.220.0140.03917.53
5.6.210.0080.04517.33
5.6.200.0120.04017.68
5.6.190.0050.04717.52
5.6.180.0070.02917.53
5.6.170.0080.04417.48
5.6.160.0170.03717.45
5.6.150.0160.03917.37
5.6.140.0130.03817.35
5.6.130.0180.03217.31
5.6.120.0130.02717.53
5.6.110.0090.04217.37
5.6.100.0070.04717.52
5.6.90.0090.04717.50
5.6.80.0110.04117.18
5.6.70.0120.04117.14
5.6.60.0090.03917.20
5.6.50.0070.04717.02
5.6.40.0130.04617.02
5.6.30.0150.04317.14
5.6.20.0120.04317.11
5.6.10.0160.04217.13
5.6.00.0130.04317.22
5.5.380.0060.02815.85
5.5.370.0080.04515.85
5.5.360.0030.04515.84
5.5.350.0020.02615.64
5.5.340.0070.02816.06
5.5.330.0130.02616.05
5.5.320.0090.04416.04
5.5.310.0050.04516.13
5.5.300.0050.04816.18
5.5.290.0150.03816.01
5.5.280.0130.04316.03
5.5.270.0050.04615.92
5.5.260.0130.03316.12
5.5.250.0080.04515.97
5.5.240.0000.04815.82
5.5.230.0060.04315.69
5.5.220.0090.03915.64
5.5.210.0050.03915.64
5.5.200.0150.03415.71
5.5.190.0100.04315.65
5.5.180.0090.04415.75
5.5.170.0140.00011.18
5.5.160.0070.02515.68
5.5.150.0110.02615.76
5.5.140.0150.03315.68
5.5.130.0100.03015.68
5.5.120.0020.02715.58
5.5.110.0050.02315.75
5.5.100.0070.02215.66
5.5.90.0070.02615.64
5.5.80.0130.02015.64
5.5.70.0130.03315.54
5.5.60.0050.02315.68
5.5.50.0100.02015.57
5.5.40.0110.03815.55
5.5.30.0100.02015.57
5.5.20.0080.03315.59
5.5.10.0080.02315.59
5.5.00.0110.03215.53
5.4.450.0070.04015.27
5.4.440.0090.04315.25
5.4.430.0130.03815.36
5.4.420.0050.04615.22
5.4.410.0110.04115.16
5.4.400.0100.03715.08
5.4.390.0000.04815.09
5.4.380.0120.02215.09
5.4.370.0050.04215.18
5.4.360.0070.04215.15
5.4.350.0050.04015.15
5.4.340.0080.04715.21
5.4.330.0070.00411.18
5.4.320.0090.02215.24
5.4.310.0070.02415.13
5.4.300.0100.02215.16
5.4.290.0080.02115.09
5.4.280.0100.02215.22
5.4.270.0080.03115.21
5.4.260.0070.02315.08
5.4.250.0150.02615.09
5.4.240.0070.02415.09
5.4.230.0070.02315.23
5.4.220.0030.02615.06
5.4.210.0090.02215.14
5.4.200.0110.02715.13
5.4.190.0070.02015.08
5.4.180.0060.01815.21
5.4.170.0050.03415.06
5.4.160.0090.02015.07
5.4.150.0070.01815.05
5.4.140.0060.02013.83
5.4.130.0080.01813.76
5.4.120.0080.02013.76
5.4.110.0090.02513.83
5.4.100.0080.01813.84
5.4.90.0080.02013.83
5.4.80.0100.02013.65
5.4.70.0020.02313.78
5.4.60.0070.01813.70
5.4.50.0100.02313.69
5.4.40.0050.02013.86
5.4.30.0110.01713.85
5.4.20.0070.02313.64
5.4.10.0110.01713.64
5.4.00.0070.02113.54
5.3.290.0060.01812.89
5.3.280.0080.01812.80
5.3.270.0030.02512.87
5.3.260.0070.02112.92
5.3.250.0050.02112.84
5.3.240.0040.03412.85
5.3.230.0070.02112.86
5.3.220.0050.03512.90
5.3.210.0050.03512.90
5.3.200.0060.01912.93
5.3.190.0050.02012.92
5.3.180.0030.02512.79
5.3.170.0050.02712.84
5.3.160.0090.02412.84
5.3.150.0030.02212.87
5.3.140.0020.02412.84
5.3.130.0070.02312.90
5.3.120.0070.01812.79
5.3.110.0080.01912.76
5.3.100.0070.02012.66
5.3.90.0030.02312.64
5.3.80.0060.02012.53
5.3.70.0070.02012.63
5.3.60.0030.04512.54
5.3.50.0050.02712.51
5.3.40.0070.01712.53
5.3.30.0050.03412.50
5.3.20.0050.03512.47
5.3.10.0050.03912.39
5.3.00.0100.03512.32
5.2.170.0030.02012.06
5.2.160.0020.01712.06
5.2.150.0060.03212.06
5.2.140.0080.03012.06
5.2.130.0050.03212.06
5.2.120.0060.03312.06
5.2.110.0060.02812.06
5.2.100.0080.02812.06
5.2.90.0000.03012.06
5.2.80.0050.03012.06
5.2.70.0030.03312.06
5.2.60.0080.03012.06
5.2.50.0080.03012.06
5.2.40.0050.02812.06
5.2.30.0050.02712.06
5.2.20.0050.03312.06
5.2.10.0050.02412.06
5.2.00.0070.03112.06
5.1.60.0080.02512.06
5.1.50.0090.02712.06
5.1.40.0080.02612.06
5.1.30.0070.03012.06
5.1.20.0110.02312.06
5.1.10.0070.03012.06
5.1.00.0050.03012.06
5.0.50.0000.02512.06
5.0.40.0110.01812.06
5.0.30.0080.01812.06
5.0.20.0030.02112.06
5.0.10.0030.02412.06
5.0.00.0050.03012.06
4.4.90.0010.01112.06
4.4.80.0020.01912.06
4.4.70.0060.01012.06
4.4.60.0010.02112.06
4.4.50.0020.01912.06
4.4.40.0100.02212.06
4.4.30.0070.01512.06
4.4.20.0050.02012.06
4.4.10.0000.01712.06
4.4.00.0020.03012.06
4.3.110.0060.01012.06
4.3.100.0040.00812.06
4.3.90.0020.01712.06
4.3.80.0020.02912.06
4.3.70.0020.01812.06
4.3.60.0030.01012.06
4.3.50.0070.01512.06
4.3.40.0020.03012.06
4.3.30.0050.01712.06
4.3.20.0030.01712.06
4.3.10.0030.02012.06
4.3.00.0030.01812.06

preferences:
69.98 ms | 400 KiB | 5 Q