changing values deep in an array by reference, with some index vars in array..
[email protected] (Rene Veerman)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
Hi.. I've got a db-insert command array that's several levels deep.. Let's abstract this as: $wm[$idx1][$idx2][$idx3][..etc] //$WorkMemory Several of my helper functions need to work on the "original, top-call_level" $wm. So i pass it as &$wm, and have the helper function declarations accept it as such aswell. Some of the $idxN vars are in an array $pathToDBcmd ($idx3, $idx4, ...) in some of the helper functions. Now i need to change a variable deep in the original, top-call_level $wm, but with some of the required indexes in $pathToDBcmd.. I can't use something like $wm[$idx1][$idx2][$pathToDBcmd[0]][$pathToDBcmd[1]] because i dont know what count($pathToDBcmd) is.. Tips will be much appreciated..