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";
?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to