3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ReformatPhoneNumber($number) { if(!preg_match('#^\d(\d[\? ]?){5,10}\d$#')) { throw new Exception('Invalid phone number'); } return str_replace(array('-', ' '), '', $number); } $a = array('01234567', '-12345678', '01--23457', '111111112345', '111-111-339-1-1-0', '01110111-', '1237'); foreach($a as $b) { try{ var_dump(ReformatPhoneNumber($b)); } catch(Exception $e) {} }

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.0140.00016.63
8.3.50.0130.00721.99
8.3.40.0140.00318.89
8.3.30.0110.00419.04
8.3.20.0000.00720.16
8.3.10.0050.00223.53
8.3.00.0040.00419.50
8.2.180.0030.01518.54
8.2.170.0140.00022.96
8.2.160.0030.01020.33
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0030.00522.12
8.2.110.0050.00522.11
8.2.100.0100.00317.91
8.2.90.0050.00319.17
8.2.80.0080.00018.16
8.2.70.0050.00317.50
8.2.60.0050.00317.80
8.2.50.0040.00418.07
8.2.40.0000.00818.22
8.2.30.0040.00418.13
8.2.20.0000.00817.75
8.2.10.0050.00318.01
8.2.00.0060.00317.68
8.1.280.0070.01325.92
8.1.270.0040.00423.96
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0060.00323.83
8.1.230.0040.00719.00
8.1.220.0040.00417.74
8.1.210.0000.00918.77
8.1.200.0040.00417.23
8.1.190.0080.00017.42
8.1.180.0040.00418.10
8.1.170.0060.00618.49
8.1.160.0000.00721.94
8.1.150.0040.00418.61
8.1.140.0040.00417.52
8.1.130.0030.00317.79
8.1.120.0000.00717.47
8.1.110.0060.00317.35
8.1.100.0000.00717.46
8.1.90.0000.00717.45
8.1.80.0040.00417.51
8.1.70.0030.00317.34
8.1.60.0060.00317.47
8.1.50.0040.00417.53
8.1.40.0000.00817.41
8.1.30.0040.00417.64
8.1.20.0000.00817.53
8.1.10.0030.00617.42
8.1.00.0000.00717.48
8.0.300.0050.00318.77
8.0.290.0050.00217.18
8.0.280.0040.00318.38
8.0.270.0040.00417.29
8.0.260.0030.00316.80
8.0.250.0030.00317.00
8.0.240.0030.00317.00
8.0.230.0040.00417.02
8.0.220.0000.00717.00
8.0.210.0030.00316.86
8.0.200.0030.00317.00
8.0.190.0040.00416.98
8.0.180.0080.00016.88
8.0.170.0030.00616.90
8.0.160.0040.00416.81
8.0.150.0080.00017.00
8.0.140.0070.00016.82
8.0.130.0000.00513.39
8.0.120.0040.00416.88
8.0.110.0040.00417.02
8.0.100.0050.00216.80
8.0.90.0040.00416.96
8.0.80.0030.01016.99
8.0.70.0030.00516.86
8.0.60.0040.00417.08
8.0.50.0000.00717.00
8.0.30.0100.00917.11
8.0.20.0090.00917.40
8.0.10.0040.00417.05
8.0.00.0050.01416.76
7.4.330.0020.00215.07
7.4.320.0050.00216.54
7.4.300.0030.00316.45
7.4.290.0040.00416.57
7.4.280.0070.00016.55
7.4.270.0030.00516.50
7.4.260.0000.00716.52
7.4.250.0000.00716.48
7.4.240.0030.00316.54
7.4.230.0000.00716.56
7.4.220.0120.00616.61
7.4.210.0100.00516.52
7.4.200.0070.00016.70
7.4.190.0030.00316.42
7.4.160.0080.00816.30
7.4.150.0140.00317.40
7.4.140.0050.01417.86
7.4.130.0100.00716.66
7.4.120.0090.00716.48
7.4.110.0070.01016.59
7.4.100.0130.00916.61
7.4.90.0110.00816.57
7.4.80.0080.01519.39
7.4.70.0110.00616.58
7.4.60.0150.00616.48
7.4.50.0050.00316.40
7.4.40.0090.00922.77
7.4.30.0110.00516.67
7.4.00.0070.00715.11
7.3.330.0000.00513.36
7.3.320.0050.00213.23
7.3.310.0070.00016.35
7.3.300.0000.00716.41
7.3.290.0040.01116.40
7.3.280.0100.00716.34
7.3.270.0070.01017.40
7.3.260.0110.00516.59
7.3.250.0140.00416.64
7.3.240.0100.01016.44
7.3.230.0100.00616.47
7.3.210.0090.00816.30
7.3.200.0110.00719.39
7.3.190.0060.01216.48
7.3.180.0100.00716.48
7.3.170.0090.00716.46
7.3.160.0140.00316.53
7.3.120.0070.01114.97
7.3.10.0030.01516.69
7.3.00.0070.00716.52
7.2.330.0120.00616.69
7.2.320.0150.00916.68
7.2.310.0100.00616.55
7.2.300.0170.00016.34
7.2.290.0070.01016.73
7.2.130.0060.00616.91
7.2.120.0080.00817.03
7.2.110.0110.00616.80
7.2.100.0070.00716.69
7.2.90.0070.00716.89
7.2.80.0030.00616.88
7.2.70.0060.00916.98
7.2.60.0000.01316.95
7.2.50.0060.01016.91
7.2.40.0040.01116.82
7.2.30.0000.01616.97
7.2.20.0070.01016.87
7.2.10.0040.01116.86
7.2.00.0150.00416.78
7.1.250.0090.00315.75
7.1.240.0110.00415.82
7.1.230.0070.00715.86
7.1.220.0140.00015.53
7.1.210.0080.00815.75
7.1.200.0040.00715.55
7.1.190.0070.00415.59
7.1.180.0000.01015.91
7.1.170.0000.01515.77
7.1.160.0040.00415.67
7.1.150.0040.00715.90
7.1.140.0070.00315.83
7.1.130.0030.01215.75
7.1.120.0000.00815.42
7.1.110.0030.01315.77
7.1.100.0070.00715.90
7.1.90.0030.01015.72
7.1.80.0030.00715.44
7.1.70.0060.00316.62
7.1.60.0090.01117.50
7.1.50.0050.01016.37
7.1.40.0060.00615.71
7.1.30.0100.00315.76
7.1.20.0000.01215.69
7.1.10.0000.00915.86
7.1.00.0030.04319.07
7.0.330.0030.00715.51
7.0.320.0060.00615.30
7.0.310.0030.01015.52
7.0.300.0000.01415.41
7.0.290.0030.01015.44
7.0.280.0120.00315.14
7.0.270.0000.00815.22
7.0.260.0050.00315.18
7.0.250.0030.01015.35
7.0.240.0100.00315.44
7.0.230.0120.00015.51
7.0.220.0060.00615.07
7.0.210.0000.00815.56
7.0.200.0090.00516.15
7.0.190.0000.01215.14
7.0.180.0030.01015.29
7.0.170.0030.00915.30
7.0.160.0070.00715.14
7.0.150.0030.01015.28
7.0.140.0020.04518.58
7.0.130.0090.00315.18
7.0.120.0030.01415.25
7.0.110.0030.00615.48
7.0.100.0220.03617.61
7.0.90.0280.02717.72
7.0.80.0260.04217.77
7.0.70.0210.03117.58
7.0.60.0270.04117.54
7.0.50.0250.04217.78
7.0.40.0040.04616.61
7.0.30.0080.04516.77
7.0.20.0050.03416.75
7.0.10.0030.04516.64
7.0.00.0050.02316.66
5.6.380.0070.00714.46
5.6.370.0080.00413.98
5.6.360.0070.00713.84
5.6.350.0100.00714.14
5.6.340.0100.00714.54
5.6.330.0070.00714.07
5.6.320.0060.00314.31
5.6.310.0000.01014.44
5.6.300.0060.00314.22
5.6.290.0030.01014.11
5.6.280.0070.03917.71
5.6.270.0000.01214.09
5.6.260.0090.00014.19
5.6.250.0020.03917.46
5.6.240.0100.03817.40
5.6.230.0080.03617.46
5.6.220.0050.04617.51
5.6.210.0060.03917.42
5.6.200.0070.03517.60
5.6.190.0100.04217.61
5.6.180.0040.02617.76
5.6.170.0090.02017.55
5.6.160.0020.04317.67
5.6.150.0050.03217.48
5.6.140.0030.02817.59
5.6.130.0060.04017.61
5.6.120.0050.03217.73
5.6.110.0090.04017.58
5.6.100.0100.03717.69
5.6.90.0070.02417.68
5.6.80.0070.03517.22
5.6.70.0070.02017.35
5.6.60.0090.02717.19
5.6.50.0050.03717.26
5.6.40.0060.02817.31
5.6.30.0080.02217.21
5.6.20.0080.03017.37
5.6.10.0030.02517.36
5.6.00.0050.03317.24
5.5.380.0050.03715.76
5.5.370.0050.04415.93
5.5.360.0070.03215.68
5.5.350.0050.03715.84
5.5.340.0080.03815.94
5.5.330.0040.04215.95
5.5.320.0050.03115.90
5.5.310.0030.02715.95
5.5.300.0020.03716.00
5.5.290.0070.02515.93
5.5.280.0050.04816.03
5.5.270.0080.03316.09
5.5.260.0010.03315.97
5.5.250.0070.04115.62
5.5.240.0010.03415.60
5.5.230.0070.02715.62
5.5.220.0000.03815.66
5.5.210.0090.04015.62
5.5.200.0050.03615.55
5.5.190.0100.01715.60
5.5.180.0020.03715.57
5.5.170.0030.01011.16
5.5.160.0050.03015.53
5.5.150.0070.01815.69
5.5.140.0030.03115.56
5.5.130.0080.03915.57
5.5.120.0040.02715.38
5.5.110.0020.02615.61
5.5.100.0050.02815.50
5.5.90.0080.03415.41
5.5.80.0030.02315.36
5.5.70.0050.03515.58
5.5.60.0110.03315.35
5.5.50.0020.02615.56
5.5.40.0030.02315.66
5.5.30.0000.02515.66
5.5.20.0090.03415.53
5.5.10.0100.02115.57
5.5.00.0050.02915.49
5.4.450.0080.01915.14
5.4.440.0090.03615.32
5.4.430.0050.04315.26
5.4.420.0020.04715.17
5.4.410.0130.02614.99
5.4.400.0050.02215.07
5.4.390.0020.02614.98
5.4.380.0050.02214.94
5.4.370.0070.03715.08
5.4.360.0030.02915.10
5.4.350.0100.03115.10
5.4.340.0060.02315.05
5.4.330.0040.00410.87
5.4.320.0030.02515.03
5.4.310.0070.02414.81
5.4.300.0030.02914.94
5.4.290.0020.02014.98
5.4.280.0040.04415.04
5.4.270.0080.03314.86
5.4.260.0080.02415.20
5.4.250.0030.02415.09
5.4.240.0100.01314.97
5.4.230.0030.02314.98
5.4.220.0050.02715.11
5.4.210.0050.01815.02
5.4.200.0050.02115.10
5.4.190.0060.01814.82
5.4.180.0050.03415.06
5.4.170.0020.02915.01
5.4.160.0020.03914.87
5.4.150.0030.02314.72
5.4.140.0030.03013.74
5.4.130.0020.02313.55
5.4.120.0060.01613.56
5.4.110.0050.02313.74
5.4.100.0050.02013.59
5.4.90.0070.02413.65
5.4.80.0030.03013.78
5.4.70.0050.03413.76
5.4.60.0080.03813.70
5.4.50.0050.03313.68
5.4.40.0020.03013.49
5.4.30.0020.02413.65
5.4.20.0050.02713.71
5.4.10.0030.02313.63
5.4.00.0040.02913.28
5.3.290.0090.03312.64
5.3.280.0030.03312.56
5.3.270.0070.01812.71
5.3.260.0040.02212.58
5.3.250.0030.02212.52
5.3.240.0040.03912.47
5.3.230.0050.02812.64
5.3.220.0100.01512.56
5.3.210.0060.04212.51
5.3.200.0110.03012.59
5.3.190.0080.01812.60
5.3.180.0030.04012.61
5.3.170.0050.03412.67
5.3.160.0050.02312.64
5.3.150.0060.04012.67
5.3.140.0090.03012.63
5.3.130.0020.02212.59
5.3.120.0080.01812.58
5.3.110.0020.03512.43
5.3.100.0070.03212.21
5.3.90.0030.04112.40
5.3.80.0050.03312.18
5.3.70.0100.03012.32
5.3.60.0010.04612.18
5.3.50.0070.03412.23
5.3.40.0040.03612.11
5.3.30.0070.03312.33
5.3.20.0090.01812.09
5.3.10.0050.02412.04
5.3.00.0030.03211.85
5.2.170.0040.01810.30
5.2.160.0020.02010.43
5.2.150.0020.03510.35
5.2.140.0030.02610.35
5.2.130.0090.02010.29
5.2.120.0070.02610.21
5.2.110.0020.02110.38
5.2.100.0030.01810.39
5.2.90.0050.02010.20
5.2.80.0060.03310.28
5.2.70.0040.03410.25
5.2.60.0100.02810.18
5.2.50.0080.01310.26
5.2.40.0060.03110.30
5.2.30.0040.02710.18
5.2.20.0060.02610.20
5.2.10.0080.02510.13
5.2.00.0100.02510.03
5.1.60.0010.0169.74
5.1.50.0000.0169.62
5.1.40.0030.0159.70
5.1.30.0070.0129.81
5.1.20.0030.0319.91
5.1.10.0070.0109.77
5.1.00.0020.0309.73
5.0.50.0020.0129.01
5.0.40.0030.0198.95
5.0.30.0030.0168.81
5.0.20.0030.0128.86
5.0.10.0020.0168.82
5.0.00.0040.0208.84
4.4.90.0030.0108.63
4.4.80.0020.0218.63
4.4.70.0020.0198.63
4.4.60.0030.0098.63
4.4.50.0000.0128.63
4.4.40.0040.0288.63
4.4.30.0020.0158.63
4.4.20.0010.0188.63
4.4.10.0020.0138.64
4.4.00.0010.0138.64
4.3.110.0000.0158.64
4.3.100.0010.0118.64
4.3.90.0000.0138.64
4.3.80.0070.0158.64
4.3.70.0020.0108.64
4.3.60.0000.0188.64
4.3.50.0020.0108.64
4.3.40.0020.0208.64
4.3.30.0000.0188.64
4.3.20.0020.0158.64
4.3.10.0020.0178.64
4.3.00.0020.0108.64

preferences:
41.24 ms | 401 KiB | 5 Q