Change an array element's value. (Notice the &$value)


SUBMITTED BY: henry1874w

DATE: June 26, 2017, 5:04 p.m.

FORMAT: Text only

SIZE: 160 Bytes

HITS: 247

  1. <?php
  2. function myfunction(&$value,$key)
  3. {
  4. $value="yellow";
  5. }
  6. $a=array("a"=>"red","b"=>"green","c"=>"blue");
  7. array_walk($a,"myfunction");
  8. print_r($a);
  9. ?>

comments powered by Disqus