PHP pass associative array from one function to another wihle keeping keys intact
- by veronica
I have two functions and one array
function A {
$segments = array();
$segments['word']=$var1;
$segments['word2']=$var2;
$segments['word3']=$var3;
return $segments;
}
function B {
$someVar=$segments['word'];
$someVar1=$segments['word'];
$someVar2=$segments['word'];
$vars['other_stuff']...
return $vars;
}
but I am not passing $segments['word']...word3'] to the second function.
I am passing
$segments[0];
$segments[1];
etc...
How can I pass the keys to second function
$segments['word']
$segments['word1']
$segments['word2']
Thank you,