> > hmm...weird! is that the code? > if you show us your real code...maybe you're missing a small detail... > Sorry about the variable names... I can print the variable inside the function until it goes through ereg_replace. Then it's gone. The code works fine if I replace the line '$song = $id3info["TIT2"]["data"];' with '$song = "some text string";' Since it's getting the variables value from an included file's functions that return and assoc. array... it's a bit confusing. I everything is fine up till the built-in function (inside my function) is called. Weird is right...
<?php include("getid3.php"); function RemoveSpaces($shittoreplace) { // Removes spaces and other characters that could cause problems. $shittoreplace = ereg_replace(" ", "_", "$shittoreplace"); return $shittoreplace; } $id3info = (getID3("music.mp3")); $song = $id3info["TIT2"]["data"]; $newsong = RemoveSpaces("$song"); echo "$newsong"; ?> >> I'm assigning a variable a value from an associative array. >> $variable = $array["key"]["value"]; >> >> Then passing the $variable to a function. >> SomeFunction($variable) >> >> The variable exists (can be printed) until a built-in function (within the >> original function) is called. >> echo "$variable"; //prints out fine >> $variable2 = ereg_replace(" ", "_", "$variable"); >> echo "$variable"; //prints out NOTHING... >> >> Why is this and how can I get around it? -- 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]