//below example now works thanks to Alexander.
I am trying to use array_walk_recursive, and I can't get the original value in the array to change. What exactly am I doing wrong here?
public function setConstants()
{
array_walk_recursive($this->_arr, function(&$item, $key2){
$constants = get_defined_constants(true);
foreach($constants["user"] as $key => $value)
{
if (strstr($item, $key)){
$item = str_replace($key,$value,&$item); //EDITED FOR VALIDITY, WORKS.
}
}
});
return $this->_arr;
}
I am trying to traverse the multidemensional array "_arr" using array_walk_recursive, and for every constant thats part of constants[user] (which is an array as well) i want to replace the equivalent value in _arr if the string matches the constant name