3v4l.org

run code in 300+ PHP versions simultaneously
<?php function formatAds(array $ad): array { $ad['last_name'] = ucfirst($ad['last_name']); $ad['first_name'] = ucfirst($ad['first_name']); $phoneNumber = preg_replace(['/ /', '/^0?33/'], ['', '0'], $ad['phone_number']); $ad['phone_number'] = preg_match('/^0[1-9][\d]{8}$/', $phoneNumber, $matches) ? $matches[0] : null; return $ad; } $ad1 = [ "last_name" => "foo", "first_name" => "bar", "phone_number" => "04 55 66 77 11", ]; $ad2 = [ "last_name" => "flow", "first_name" => "blow", "phone_number" => "334 55 66 77 11", ]; $ad3 = [ "last_name" => "beez", "first_name" => "wiiz", "phone_number" => "0334 55 66 77 11", ]; print_r(formatAds($ad1)); print_r(formatAds($ad2)); print_r(formatAds($ad3));

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.4.120.0100.01124.04
8.4.110.0070.00222.51
8.4.100.0140.00719.04
8.4.90.0110.01120.54
8.4.80.0120.00417.80
8.4.70.0100.00718.24
8.4.60.0130.00719.89
8.4.50.0130.00820.47
8.4.40.0130.00718.08
8.4.30.0100.01020.32
8.4.20.0080.01218.09
8.4.10.0100.01019.86
8.3.250.0110.00918.81
8.3.240.0100.01016.95
8.3.230.0060.00316.68
8.3.220.0120.00718.82
8.3.210.0100.01016.63
8.3.200.0110.00816.58
8.3.190.0100.00916.85
8.3.180.0100.00916.54
8.3.170.0070.01118.92
8.3.160.0040.01117.47
8.3.150.0060.01317.07
8.3.140.0090.00616.70
8.3.130.0050.00516.85
8.3.120.0090.00620.73
8.3.110.0040.00416.91
8.3.100.0070.00318.70
8.3.90.0110.00726.77
8.3.80.0060.00316.63
8.3.70.0130.00616.58
8.3.60.0120.00916.50
8.3.50.0040.01118.35
8.3.40.0110.00718.92
8.3.30.0040.01219.00
8.3.20.0040.00424.18
8.3.10.0050.00324.66
8.3.00.0050.00326.16
8.2.290.0090.01120.21
8.2.280.0130.00716.58
8.2.270.0120.00617.41
8.2.260.0060.00318.43
8.2.250.0000.00816.73
8.2.240.0060.00317.25
8.2.230.0040.00420.94
8.2.220.0120.00624.06
8.2.210.0090.00926.77
8.2.200.0000.00917.00
8.2.190.0140.00716.88
8.2.180.0110.00425.92
8.2.170.0070.00719.13
8.2.160.0100.00722.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0040.00426.35
8.2.110.0030.00621.04
8.2.100.0040.00817.91
8.2.90.0040.00417.88
8.2.80.0050.00318.86
8.2.70.0030.00517.77
8.2.60.0000.00918.03
8.2.50.0030.00618.10
8.2.40.0080.00019.47
8.2.30.0060.00319.27
8.2.20.0030.00518.00
8.2.10.0040.00419.27
8.2.00.0050.00219.26
8.1.330.0140.00421.89
8.1.320.0120.00816.31
8.1.310.0140.00318.71
8.1.300.0100.01018.60
8.1.290.0000.00830.84
8.1.280.0070.00725.92
8.1.270.0040.00423.99
8.1.260.0000.00728.09
8.1.250.0050.00328.09
8.1.240.0050.00517.35
8.1.230.0050.00517.89
8.1.220.0030.00517.74
8.1.210.0050.00318.77
8.1.200.0050.00517.47
8.1.190.0040.00417.35
8.1.180.0060.00318.10
8.1.170.0000.00818.78
8.1.160.0070.00320.86
8.1.150.0040.00418.86
8.1.140.0070.00018.77
8.1.130.0000.00720.02
8.1.120.0000.00717.53
8.1.110.0070.00017.55
8.1.100.0040.00417.54
8.1.90.0000.00717.55
8.1.80.0030.00717.54
8.1.70.0040.00417.41
8.1.60.0090.00017.80
8.1.50.0030.00517.62
8.1.40.0030.00617.68
8.1.30.0040.00817.71
8.1.20.0030.00517.82
8.1.10.0030.00517.64
8.1.00.0000.00917.67
8.0.300.0050.00218.77
8.0.290.0060.00316.75
8.0.280.0000.00818.35
8.0.270.0000.00716.81
8.0.260.0070.00018.33
8.0.250.0030.00317.04
8.0.240.0070.00017.09
8.0.230.0050.00317.01
8.0.220.0030.00317.00
8.0.210.0000.00816.91
8.0.200.0000.00717.08
8.0.190.0030.00516.93
8.0.180.0000.00716.90
8.0.170.0120.00017.01
8.0.160.0020.00516.88
8.0.150.0040.00416.95
8.0.140.0060.00316.88
8.0.130.0000.00513.41
8.0.120.0060.00316.90
8.0.110.0040.00416.95
8.0.100.0000.00717.00
8.0.90.0040.00416.94
8.0.80.0030.01516.92
8.0.70.0000.00817.04
8.0.60.0000.00816.98
8.0.50.0030.00516.94
8.0.30.0100.01016.98
8.0.20.0090.01017.00
8.0.10.0120.00617.15
8.0.00.0100.00617.11
7.4.330.0030.00315.55
7.4.320.0000.00716.74
7.4.300.0070.00016.83
7.4.290.0040.00416.57
7.4.280.0040.00416.73
7.4.270.0070.00016.72
7.4.260.0030.00313.60
7.4.250.0000.00716.68
7.4.240.0070.00016.73
7.4.230.0030.00316.85
7.4.220.0000.00716.71
7.4.210.0090.00716.83
7.4.200.0070.00016.57
7.4.160.0030.01516.81
7.4.150.0120.00916.85
7.4.140.0090.00616.74
7.4.130.0090.00616.79
7.4.120.0110.00416.84
7.4.110.0100.01016.59
7.4.100.0120.00916.68
7.4.90.0060.00916.67
7.4.80.0060.00916.79
7.4.70.0110.00816.76
7.4.60.0090.00916.69
7.4.50.0080.00916.78
7.4.40.0110.00816.70
7.4.30.0060.01016.61
7.4.20.0090.00616.73
7.4.10.0060.01116.60
7.4.00.0090.00916.69
7.3.330.0000.01016.55
7.3.320.0000.00713.34
7.3.310.0080.00016.39
7.3.300.0060.00016.48
7.3.290.0090.00716.48
7.3.270.0060.01416.52
7.3.260.0140.00016.49
7.3.250.0100.00716.52
7.3.240.0100.00616.59
7.3.230.0070.01316.52
7.3.220.0040.01116.41
7.3.210.0090.01216.38
7.3.200.0070.00716.45
7.3.190.0110.00716.39
7.3.180.0030.01316.37
7.3.170.0100.00516.41
7.3.160.0030.01216.37
7.3.150.0130.00416.42
7.3.140.0030.01216.42
7.3.130.0070.01116.41
7.3.120.0060.01316.38
7.3.110.0030.01416.36
7.3.100.0070.01416.42
7.3.90.0030.01116.79
7.3.80.0030.01416.55
7.3.70.0120.00316.45
7.3.60.0160.00016.50
7.3.50.0090.00616.52
7.3.40.0100.01016.53
7.3.30.0120.00816.58
7.3.20.0130.00716.40
7.3.10.0060.01716.50
7.3.00.0070.01116.48

preferences:
32.69 ms | 403 KiB | 5 Q