PHP - How to modify multi-dimensional array item from within a function?
- by Marc
My problem is as follows. I have a multidimensional array. I declare my array. Then, I run some code that populates my array partially. Then i run a function, which among others is supposed to modify some item in my array from within the function. This is unfortunately not working. So my question is simple. Is it normal? And if yes, how can I overcome this. Thank you very much in advance for your replies. Cheers. Marc.
$list = array([0]=>
array(
[name]=>'James'
[group]=>''
)
);
my_function();
print_r($list);
function my_function(){
//some code here
$list[0]['group'] = 'groupA';
}