3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ReformatPhoneNumber($n){ if(!preg_match('/\\d+?\\-?\\d+?\\s?\\d+/',$n))throw new Exception('Invalid phone number'); $n=str_replace(array('-',' '), '', $n); if(!in_array(strlen($n), array(7,12)))throw new Exception('Invalid phone number'); return $n; } echo ReformatPhoneNumber('2352-23593665');

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.00918.36
8.3.50.0150.00317.53
8.3.40.0070.01118.92
8.3.30.0070.00718.88
8.3.20.0080.00018.74
8.3.10.0000.00818.90
8.3.00.0000.00819.50
8.2.180.0060.00916.36
8.2.170.0090.00922.96
8.2.160.0120.00319.00
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00419.79
8.2.110.0050.00521.30
8.2.100.0090.00318.03
8.2.90.0040.00418.97
8.2.80.0050.00317.97
8.2.70.0050.00517.50
8.2.60.0000.00817.93
8.2.50.0080.00017.77
8.2.40.0030.00619.60
8.2.30.0040.00417.71
8.2.20.0070.00317.62
8.2.10.0060.00317.88
8.2.00.0040.00417.89
8.1.280.0070.00725.92
8.1.270.0040.00423.99
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0040.01421.29
8.1.230.0080.00417.70
8.1.220.0040.00417.79
8.1.210.0050.00318.77
8.1.200.0000.00817.36
8.1.190.0030.00517.36
8.1.180.0030.00619.26
8.1.170.0000.00817.62
8.1.160.0070.00018.91
8.1.150.0000.00718.89
8.1.140.0000.00717.59
8.1.130.0000.00717.59
8.1.120.0070.00017.51
8.1.110.0050.00317.55
8.1.100.0030.00517.55
8.1.90.0030.00417.52
8.1.80.0000.00817.64
8.1.70.0070.00017.45
8.1.60.0060.00317.79
8.1.50.0040.00417.64
8.1.40.0080.00017.51
8.1.30.0060.00317.68
8.1.20.0070.00317.73
8.1.10.0030.00617.66
8.1.00.0040.00417.47
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00718.58
8.0.270.0070.00017.19
8.0.260.0030.00316.91
8.0.250.0070.00317.16
8.0.240.0080.00017.04
8.0.230.0080.00017.12
8.0.220.0070.00017.08
8.0.210.0070.00017.02
8.0.200.0040.00417.03
8.0.190.0030.00517.05
8.0.180.0000.00717.06
8.0.170.0060.00317.09
8.0.160.0000.00716.96
8.0.150.0040.00416.94
8.0.140.0040.00417.00
8.0.130.0050.00013.47
8.0.120.0070.00316.89
8.0.110.0040.00416.93
8.0.100.0000.00817.05
8.0.90.0070.00016.91
8.0.80.0080.01516.97
8.0.70.0030.00517.04
8.0.60.0000.00817.03
8.0.50.0060.00317.03
8.0.30.0140.00717.43
8.0.20.0150.00517.11
8.0.10.0040.00417.16
8.0.00.0110.01017.05
7.4.330.0000.00513.25
7.4.320.0020.00516.83
7.4.300.0030.00316.70
7.4.290.0000.01016.82
7.4.280.0070.00016.79
7.4.270.0080.00016.72
7.4.260.0030.00313.50
7.4.250.0070.00316.79
7.4.240.0070.00016.74
7.4.230.0070.00016.56
7.4.220.0130.01416.67
7.4.210.0040.01216.68
7.4.200.0000.00816.79
7.4.190.0020.00616.99
7.4.160.0070.01016.80
7.4.150.0060.01116.64
7.4.140.0150.01217.86
7.4.130.0060.01216.46
7.4.120.0060.01216.64
7.4.110.0140.00816.78
7.4.100.0060.01516.73
7.4.90.0090.00917.00
7.4.80.0070.01116.87
7.4.70.0090.00816.60
7.4.60.0110.00616.95
7.4.50.0000.00516.79
7.4.40.0000.01516.71
7.4.30.0030.01916.68
7.4.00.0040.01114.84
7.3.330.0030.00313.40
7.3.320.0030.00313.42
7.3.310.0080.00016.34
7.3.300.0000.00716.41
7.3.290.0100.00416.40
7.3.280.0120.00316.47
7.3.270.0090.00916.79
7.3.260.0170.00516.50
7.3.240.0060.01016.37
7.3.230.0130.00316.52
7.3.210.0100.00716.30
7.3.200.0090.01519.39
7.3.190.0080.01516.43
7.3.180.0150.00016.84
7.3.170.0100.00616.82
7.3.160.0100.01316.59
7.3.120.0040.01115.02
7.2.330.0070.01116.88
7.2.320.0070.01016.78
7.2.310.0090.01316.86
7.2.300.0100.00716.80
7.2.290.0100.00716.77
7.2.00.0030.00919.70
7.1.70.0000.00717.38
7.1.60.0190.00319.25
7.1.50.0070.01716.91
7.1.00.0000.03722.34
7.0.200.0040.00416.65
7.0.140.0000.07721.92
7.0.60.0100.07319.85
7.0.50.0130.07317.89
7.0.40.0030.08320.06
7.0.30.0530.05320.08
7.0.20.0330.07720.22
7.0.10.0200.08720.32
7.0.00.0170.04320.37
5.6.280.0030.07320.82
5.6.210.0070.08020.72
5.6.200.0070.04718.22
5.6.190.0070.08020.48
5.6.180.0300.07720.41
5.6.170.0270.05020.57
5.6.160.0130.08020.55
5.6.150.0000.08718.19
5.6.140.0070.08318.26
5.6.130.0000.04318.11
5.6.120.0100.05020.99
5.6.110.0200.08020.99
5.6.100.0030.06020.96
5.6.90.0070.06320.88
5.6.80.0200.07320.41
5.6.70.4370.03320.48
5.5.350.0200.07720.34
5.5.340.0100.03317.98
5.5.330.0070.08720.41
5.5.320.0370.07320.34
5.5.310.0470.06320.24
5.5.300.0070.04717.92
5.5.290.0070.03717.94
5.5.280.0100.04020.88
5.5.270.0100.08320.77
5.5.260.0070.03720.83
5.5.250.0070.08020.71
5.5.240.0030.06720.26
5.4.450.0270.05319.54
5.4.440.3830.04319.20
5.4.430.0070.05719.38
5.4.420.0070.05719.40
5.4.410.0100.05319.21
5.4.400.0030.06019.22
5.4.390.0000.06019.16
5.4.380.0200.05718.59
5.4.370.0000.04318.74
5.4.360.0000.04318.70
5.4.350.0060.04912.02
5.4.340.0060.03812.02
5.4.320.0060.04412.50
5.4.310.0060.04212.50
5.4.300.0090.04712.50
5.4.290.0080.05412.50
5.4.280.0100.04912.40
5.4.270.0060.04712.40
5.4.260.0060.06212.40
5.4.250.0110.06512.40
5.4.240.0100.04412.40
5.4.230.0080.05112.39
5.4.220.0080.05612.39
5.4.210.0090.06112.39
5.4.200.0080.05612.39
5.4.190.0070.04912.39
5.4.180.0060.04912.39
5.4.170.0110.05812.40
5.4.160.0100.04712.39
5.4.150.0070.04612.39
5.4.140.0100.05012.07
5.4.130.0060.04912.06
5.4.120.0090.04412.02
5.4.110.0140.05312.01
5.4.100.0080.04612.01
5.4.90.0070.04612.01
5.4.80.0080.04112.01
5.4.70.0080.04112.01
5.4.60.0090.04512.01
5.4.50.0060.05012.01
5.4.40.0090.04712.00
5.4.30.0080.05811.99
5.4.20.0100.05111.99
5.4.10.0060.04812.00
5.4.00.0060.04511.48
5.3.290.0060.04312.80
5.3.280.0080.05012.71
5.3.270.0070.05312.72
5.3.260.0090.04712.72
5.3.250.0060.04912.72
5.3.240.0080.04912.72
5.3.230.0080.05012.71
5.3.220.0080.05212.68
5.3.210.0090.05512.68
5.3.200.0090.04612.68
5.3.190.0080.04312.68
5.3.180.0050.04912.67
5.3.170.0090.04512.67
5.3.160.0080.04312.67
5.3.150.0070.04312.67
5.3.140.0060.05412.66
5.3.130.0070.05012.66
5.3.120.0060.05112.66
5.3.110.0060.05112.66
5.3.100.0090.05212.12
5.3.90.0090.04912.10
5.3.80.0070.05312.09
5.3.70.0100.05612.09
5.3.60.0090.06012.08
5.3.50.0080.05712.02

preferences:
53.65 ms | 401 KiB | 5 Q