3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'a' => 'food', 'b' => 'foo', 'c' => 'goo', 'd' => 'foo', 'e' => 'good' ]; $needle = 'foo'; $newValue = 'bar'; function array_replace_value(&$ar, $value, $replacement) { $ar = preg_replace( '/^' . preg_quote($value, '/') . '$/', $replacement, $ar ); } array_replace_value($array, $needle, $newValue); var_export($array);

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.0110.01116.63
8.3.50.0110.00318.48
8.3.40.0170.00320.00
8.3.30.0110.00319.02
8.3.20.0080.00024.18
8.3.10.0090.00024.66
8.3.00.0000.00826.16
8.2.180.0110.00425.92
8.2.170.0130.00319.13
8.2.160.0040.01122.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0070.00026.16
8.2.110.0080.00322.30
8.2.100.0080.00418.03
8.2.90.0000.00817.97
8.2.80.0080.00017.75
8.2.70.0040.00417.88
8.2.60.0030.00617.93
8.2.50.0000.00818.07
8.2.40.0070.00320.95
8.2.30.0040.00417.96
8.2.20.0000.00719.27
8.2.10.0040.00418.13
8.2.00.0130.00317.75
8.1.280.0110.00425.92
8.1.270.0000.00724.66
8.1.260.0070.00026.35
8.1.250.0000.00828.09
8.1.240.0000.00922.45
8.1.230.0080.00522.70
8.1.220.0000.00817.74
8.1.210.0040.00418.96
8.1.200.0030.00617.47
8.1.190.0000.00817.35
8.1.180.0150.00318.10
8.1.170.0050.00318.73
8.1.160.0070.00018.84
8.1.150.0000.00718.78
8.1.140.0000.00717.64
8.1.130.0140.00217.54
8.1.120.0110.00517.53
8.1.110.0070.00717.53
8.1.100.0110.00517.65
8.1.90.0050.01017.65
8.1.80.0110.00417.57
8.1.70.0000.01517.73
8.1.60.0100.00517.77
8.1.50.0110.00617.66
8.1.40.0100.00717.74
8.1.30.0120.00317.70
8.1.20.0040.01617.81
8.1.10.0140.00517.59
8.1.00.0000.01017.65
8.0.300.0040.00419.73
8.0.290.0040.00416.75
8.0.280.0040.00418.38
8.0.270.0000.00717.23
8.0.260.0130.00217.00
8.0.250.0110.00417.05
8.0.240.0160.00017.02
8.0.230.0130.00316.99
8.0.220.0110.00316.95
8.0.210.0000.01316.95
8.0.200.0000.01116.93
8.0.190.0110.00016.91
8.0.180.0120.00316.87
8.0.170.0130.00016.92
8.0.160.0090.00616.94
8.0.150.0070.00316.95
8.0.140.0090.00616.98
8.0.130.0090.00616.96
8.0.120.0110.00416.98
8.0.110.0100.00516.94
8.0.100.0150.00016.87
8.0.90.0000.01116.88
8.0.80.0030.00816.87
8.0.70.0060.00316.87
8.0.60.0090.00316.90
8.0.50.0030.01016.95
8.0.30.0080.00816.88
8.0.20.0100.00616.87
8.0.10.0140.00016.89

preferences:
52.26 ms | 400 KiB | 5 Q