3v4l.org

run code in 300+ PHP versions simultaneously
<?php function format_phone($number) { $num = preg_replace('/[^0-9]/', '', $number); $l = strlen($num); if ($l < 10) { return false; } preg_match('/^([0-9]{3})([0-9]{3})([0-9]{4})([0-9]*)$/', $num, $parts); array_shift($parts); $format = '%1$d-%2$d-%3$d'; if ($l > 10) { $format .= ' x%4$d'; } return sprintf($format, ... $parts); } var_dump(format_phone('8045551234'));

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.0150.00316.58
8.3.60.0130.00318.68
8.3.50.0150.00322.17
8.3.40.0060.01018.72
8.3.30.0070.00718.54
8.3.20.0040.00422.02
8.3.10.0080.00021.73
8.3.00.0030.00522.09
8.2.180.0070.01318.54
8.2.170.0150.00022.96
8.2.160.0110.00422.39
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0050.00321.07
8.2.110.0140.00421.17
8.2.100.0080.00417.91
8.2.90.0040.00419.00
8.2.80.0040.00417.97
8.2.70.0030.00617.75
8.2.60.0000.00817.93
8.2.50.0000.00918.10
8.2.40.0080.00020.54
8.2.30.0040.00419.11
8.2.20.0040.00418.05
8.2.10.0080.00017.97
8.2.00.0000.00717.82
8.1.280.0120.00325.92
8.1.270.0040.00423.92
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0030.00619.38
8.1.230.0000.01117.64
8.1.220.0040.00417.80
8.1.210.0030.00518.77
8.1.200.0040.00417.48
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0000.00818.66
8.1.160.0000.00718.83
8.1.150.0000.00721.98
8.1.140.0030.00619.58
8.1.130.0040.00419.00
8.1.120.0030.00317.55
8.1.110.0000.00717.55
8.1.100.0000.00717.52
8.1.90.0050.00217.43
8.1.80.0040.00417.59
8.1.70.0040.00417.55
8.1.60.0040.00417.63
8.1.50.0040.00417.70
8.1.40.0000.00717.56
8.1.30.0000.00817.70
8.1.20.0030.00617.85
8.1.10.0040.00417.60
8.1.00.0000.00917.57
8.0.300.0040.00418.77
8.0.290.0080.00016.63
8.0.280.0040.00418.38
8.0.270.0070.00017.11
8.0.260.0000.00817.20
8.0.250.0030.00317.02
8.0.240.0000.00717.03
8.0.230.0040.00417.07
8.0.220.0040.00416.85
8.0.210.0060.00316.84
8.0.200.0070.00017.05
8.0.190.0070.00017.02
8.0.180.0040.00416.90
8.0.170.0040.00416.89
8.0.160.0000.00817.05
8.0.150.0040.00416.90
8.0.140.0040.00416.91
8.0.130.0000.00513.43
8.0.120.0000.00716.99
8.0.110.0020.00516.81
8.0.100.0000.00716.93
8.0.90.0040.00417.00
8.0.80.0070.00716.95
8.0.70.0000.00716.92
8.0.60.0050.00316.92
8.0.50.0000.00716.91
8.0.30.0100.00917.13
8.0.20.0130.00717.42
8.0.10.0050.00216.91
8.0.00.0070.01016.87
7.4.330.0030.00315.55
7.4.320.0070.00016.61
7.4.300.0030.00316.67
7.4.290.0030.00316.80
7.4.280.0080.00016.64
7.4.270.0000.00716.84
7.4.260.0000.00716.79
7.4.250.0000.00716.60
7.4.240.0040.00416.57
7.4.230.0000.00816.79
7.4.220.0150.00416.72
7.4.210.0060.01016.81
7.4.200.0000.00716.62
7.4.160.0110.00716.67
7.4.150.0070.01117.40
7.4.140.0130.00417.86
7.4.130.0140.00416.66
7.4.120.0090.01216.61
7.4.110.0120.00616.73
7.4.100.0080.01616.62
7.4.90.0100.00616.62
7.4.80.0150.01019.39
7.4.70.0070.01016.60
7.4.60.0080.00816.77
7.4.50.0030.01016.34
7.4.40.0090.00916.64
7.4.30.0090.00616.69
7.4.00.0110.00715.09
7.3.330.0060.00013.32
7.3.320.0020.00213.32
7.3.310.0000.00716.46
7.3.300.0070.00016.39
7.3.290.0090.00616.50
7.3.280.0070.01016.55
7.3.270.0150.00417.40
7.3.260.0060.01216.47
7.3.250.0080.01116.46
7.3.240.0060.01216.47
7.3.230.0120.00416.48
7.3.210.0110.00716.50
7.3.200.0150.00616.56
7.3.190.0070.01116.41
7.3.180.0120.00616.68
7.3.170.0120.00616.32
7.3.160.0040.01216.43
7.2.330.0080.01116.76
7.2.320.0110.00716.71
7.2.310.0140.00316.81
7.2.300.0120.01216.65
7.2.290.0060.01616.66
7.1.70.0030.00816.95
7.1.60.0030.01017.23
7.1.10.0100.08022.17
7.1.00.0130.06322.38
7.0.200.0030.01216.89
7.0.150.0100.08321.82
7.0.140.0130.05321.86
7.0.130.0100.05321.85
7.0.120.0100.05021.92
7.0.110.0000.06321.90
7.0.100.0100.05321.86
7.0.90.0100.05321.88
7.0.80.0070.05321.93
7.0.70.0030.05721.98
7.0.60.0100.05321.82
7.0.50.0100.05721.88
7.0.40.0200.04322.00
7.0.30.0070.06721.95
7.0.20.0100.06321.74
7.0.10.0030.06021.87
7.0.00.0070.05721.80

preferences:
62.8 ms | 401 KiB | 5 Q