-5

i have many variable want to store into array

$colors = array("red", "green", "blue", "yellow");

foreach ($colors as $value) {
    echo "$value <br>";
}

now i want store $value again into array

p.s: look like foolish but it is educational purpose please don't tell why i am doing already $colors array is exits

  • possible duplicate of [Reference - What does this symbol mean in PHP?](http://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php) For everyone how wants to know why i marked it as dupe: http://imgur.com/kFwPK8d – Rizier123 Feb 21 '15 at 22:47
  • Please read question i have no idea why you mark duplicate – Qmobile Noir Feb 21 '15 at 22:48
  • Because you completely changed your question! Why did you completely changed your question?!? – Rizier123 Feb 21 '15 at 22:48

1 Answers1

0
$colors = array("red", "green", "blue", "yellow");

foreach ($colors as $key => $value) {
    $value = strtoupper($value);
    $colors[$key] = $value;
}
Mex
  • 983
  • 6
  • 15