Get your own PHP server Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<pre>
<?php
$colors = array("red", "green", "blue", "yellow");
foreach ($colors as &$x) {
  if ($x == "blue") $x = "pink";
}
var_dump($colors);
?>
</pre>
</body>
</html>
array(4) {
  [0]=>
  string(3) "red"
  [1]=>
  string(5) "green"
  [2]=>
  string(4) "pink"
  [3]=>
  string(6) "yellow"
}