changing values deep in an array by reference, with some index vars in array..

From: Date: Thu, 11 Mar 2010 08:35:07 +0000
Subject: changing values deep in an array by reference, with some index vars in array..
Groups: php.general 
Request: Send a blank email to php-general+get-302693@lists.php.net to get a copy of this message
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..

« previous php.general (#302693) next »