3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_replace_key($search, $replace, array $target) { $return = array(); foreach ($target as $key => $val) { if ($search === $key) { $return[$replace] = $val; } else { $return[$key] = $val; } } } $a = array('a' => 'franz', 'b' => 'cheryl', 'c' => 'samantha'); var_dump(array_replace_key('a', 'a-xxx' $a));

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)
5.4.260.0170.04718.95
5.4.250.0200.06018.79
5.4.240.0030.06318.76
5.4.230.0070.07719.04
5.4.220.0070.05318.76
5.4.210.0030.05318.77
5.4.200.0130.04319.00
5.4.190.0030.05318.93
5.4.180.0100.05018.70
5.4.170.0100.05018.78
5.4.160.0100.04718.77
5.4.150.0100.05018.94
5.4.140.0030.05316.36
5.4.130.0030.05016.58
5.4.120.0030.05316.58
5.4.110.0070.05716.41
5.4.100.0100.04316.56
5.4.90.0130.04016.51
5.4.80.0100.04316.47
5.4.70.0000.05316.40
5.4.60.0130.05716.46
5.4.50.0100.04716.46
5.4.40.0030.05316.43
5.4.30.0100.04316.52
5.4.20.0070.05316.45
5.4.10.0130.04316.35
5.4.00.0070.04715.99
5.3.280.0100.06714.49
5.3.270.0000.06014.68
5.3.260.0100.05014.51
5.3.250.0070.07314.82
5.3.240.0070.05014.62
5.3.230.0100.06714.82
5.3.220.0100.04714.65
5.3.210.0070.05014.55
5.3.200.0070.05314.79
5.3.190.0170.04014.64
5.3.180.0000.05314.70
5.3.170.0100.04714.46
5.3.160.0030.06714.78
5.3.150.0070.05014.64
5.3.140.0030.05314.72
5.3.130.0070.05314.77
5.3.120.0000.06014.62
5.3.110.0030.05714.63
5.3.100.0030.05014.02
5.3.90.0030.05014.08
5.3.80.0100.04314.00
5.3.70.0130.04014.24
5.3.60.0130.06714.18
5.3.50.0030.05014.03
5.3.40.0170.05713.92
5.3.30.0030.07713.73
5.3.20.0170.03713.69
5.3.10.0070.04713.73
5.3.00.0100.04313.71
5.2.170.0070.04011.23
5.2.160.0000.04711.13
5.2.150.0100.03711.32
5.2.140.0000.06011.14
5.2.130.0200.03711.32
5.2.120.0070.03711.16
5.2.110.0070.05311.16
5.2.100.0030.04011.10
5.2.90.0070.03711.08
5.2.80.0070.03711.27
5.2.70.0100.04710.93
5.2.60.0070.03711.28
5.2.50.0030.06011.10
5.2.40.0100.03711.09
5.2.30.0070.04711.05
5.2.20.0070.04011.04
5.2.10.0030.04010.93
5.2.00.0030.04010.79
5.1.60.0100.0339.84
5.1.50.0000.03710.23
5.1.40.0000.03710.13
5.1.30.0030.03710.51
5.1.20.0100.03710.42
5.1.10.0100.03710.16
5.1.00.0030.03710.16
5.0.50.0030.0408.52
5.0.40.0030.0278.36
5.0.30.0030.0408.26
5.0.20.0100.0208.43
5.0.10.0000.0338.23
5.0.00.0000.0438.21
4.4.90.0000.0235.84
4.4.80.0000.0235.85
4.4.70.0070.0175.80
4.4.60.0000.0235.84
4.4.50.0000.0235.84
4.4.40.0000.0375.85
4.4.30.0000.0235.81
4.4.20.0030.0205.95
4.4.10.0000.0236.03
4.4.00.0030.0405.90
4.3.110.0030.0205.80
4.3.100.0070.0205.75
4.3.90.0030.0205.77
4.3.80.0070.0275.89
4.3.70.0000.0305.74
4.3.60.0000.0235.87
4.3.50.0030.0235.74
4.3.40.0000.0335.84
4.3.30.0000.0305.45
4.3.20.0000.0275.45
4.3.10.0100.0135.45
4.3.00.0030.0277.30

preferences:
141.67 ms | 1394 KiB | 7 Q