I have an array, lets call $x, so
$x = array(
'a'=> 1,
'b'=> 2,
'c'=> 3
);
I wants to replace the value of suppose for c, so I can do it by
$x[c] = 4;
Its works, but if I want to do it using a function, I can write a function
function changevalue ($a, $k, $v) {
$a[$k] = $v;
return $a;
}
and then use this function to change the value
changevalue($x, 'c', 4);
it doesn't work, but if I set it equals to $x
$x = changevalue($x, 'c', 4);
it works. my question is why I need to set the function equals to the array. I'm new to PHP, it will be very helping if someone explains. Thanx in advance. :)