passing a multi dimensional associative array...

From: Date: Thu, 25 Oct 2001 10:23:43 +0000
Subject: passing a multi dimensional associative array...
Groups: php.general 
Request: Send a blank email to php-general+get-72239@lists.php.net to get a copy of this message
Pardon me if I've been smoking too much crack but I can't seem to figure this one out... How do I pass an argument to a function that contains a value from multi dimensional associative array? or... How do I pass an variable as an argument that contains value taken from an array? or... Why doesn't the following work? The following (barring any typos) works for me if the variable $newstring is passed with a value of "Some Random Text" (it is returned with spaces replace by underscores) but does not work when passing the "$newstring = $somearray["thing"]["data"]" line. I'm missing something here... TIA, Spunk <?php function RemoveWeirdChars($stringtoreplace) { // Removes spaces that could cause problems. $replacedstring = (ereg_replace(" ", "_", "$stringtoreplace")); return $replacedstring; } //$newstring = "Some Random Text"; //This works... //value comes from an multi-assoc-array $newstring = $somearray["thing"]["data"]; //doesn't work //$finishedstring = (ereg_replace(" ", "_", $newstring)); $finishedstring = (RemoveWeirdChars($newstring)); echo "$finishedstring"; ?>

« previous php.general (#72239) next »