3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ['a' => 'val1', 'b' => 'val2', 'c' => 'val3', 'd' => 'val4', 'e' => 'val5']; $swaps = ['a' => 'd', 'd' => 'a'/*, 'b' => 'e', 'e' => 'b'*/]; $result = []; foreach ($array as $k => $v) { if (!isset($swaps[$k], $array[$swaps[$k]])) { $result[$k] = $v; } else { $result[$swaps[$k]] = $array[$swaps[$k]]; } } var_export($result);

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.5.10.0110.00616.84
8.5.00.0110.01019.88
8.4.160.0130.00920.66
8.4.150.0020.00014.05
8.4.140.0100.01217.78
8.4.130.0050.00517.95
8.4.120.0140.00622.34
8.4.110.0080.00722.44
8.4.100.0040.00518.63
8.4.90.0090.01019.00
8.4.80.0060.00420.64
8.4.70.0050.00418.15
8.4.60.0060.01018.95
8.4.50.0120.00518.61
8.4.40.0110.01117.69
8.4.30.0120.00618.68
8.4.20.0280.00017.50
8.4.10.0180.00717.65
8.3.280.0000.00214.05
8.3.270.0160.00516.50
8.3.260.0120.00716.61
8.3.250.0120.00818.68
8.3.240.0150.00416.73
8.3.230.0140.00516.80
8.3.220.0090.00918.95
8.3.210.0060.00418.33
8.3.200.0070.00116.63
8.3.190.0050.00317.35
8.3.180.0090.01217.34
8.3.170.0080.00017.29
8.3.160.0120.00318.48
8.3.150.0180.00316.26
8.3.140.0030.00716.55
8.3.130.0160.00416.47
8.3.120.0140.00716.30
8.3.110.0160.00216.37
8.3.100.0170.00416.54
8.3.90.0150.00716.66
8.3.80.0210.00016.49
8.3.70.0130.00916.30
8.3.60.0130.00816.54
8.3.50.0170.00316.38
8.3.40.0110.00617.30
8.3.30.0100.00717.11
8.3.20.0130.00317.43
8.3.10.0130.00317.44
8.3.00.0180.00017.34
8.2.290.0120.00720.55
8.2.280.0100.00918.36
8.2.270.0040.00416.43
8.2.260.0170.00016.69
8.2.250.0100.00716.53
8.2.240.0110.00616.46
8.2.230.0150.00216.09
8.2.220.0130.00716.45
8.2.210.0150.00316.54
8.2.200.0080.00816.23
8.2.190.0190.00016.28
8.2.180.0130.00316.49
8.2.170.0190.00017.36
8.2.160.0140.00517.46
8.2.150.0200.00017.43
8.2.140.0180.00417.30
8.2.130.0130.00617.29
8.2.120.0110.00817.42
8.2.110.0160.00317.36
8.2.100.0130.00317.65
8.2.90.0180.00017.43
8.2.80.0090.00917.44
8.2.70.0090.00917.43
8.2.60.0150.00317.51
8.2.50.0170.00017.16
8.2.40.0140.00317.24
8.2.30.0140.00217.11
8.2.20.0190.00017.23
8.2.10.0180.00017.43
8.2.00.0170.00017.46
8.1.320.0130.00616.21

preferences:
57.48 ms | 403 KiB | 5 Q