View Full Version : why does this str_replace not work?

02-06-2010, 06:09 PM
this doesnt work and i cant figure out why....


$uploaded_thumbs_array = Array ([0] => t_Desert Landscape_1.jpg )

foreach($uploaded_thumbs_array as $uploaded_thumbs){
str_replace(' ', '_', $uploaded_thumbs);
print_r($uploaded_thumbs_array);the print_r($uploaded_thumbs_array); returns
Array ([0] => t_Desert Landscape_1.jpg )THe DAMN spaces are still there.... WHY???????

02-07-2010, 07:40 PM

$uploaded_thumbs_array = array(1 => 't_Desert Landscape_1.jpg', 2 => 't_Desert Landscape_2.jpg', 3 => 't_Desert Landscape_3.jpg');

foreach($uploaded_thumbs_array as $uploaded_thumbs){
$uploaded_thumbs = str_replace(" ", "_", $uploaded_thumbs);

echo $uploaded_thumbs."<br>";

will output......


02-09-2010, 01:12 AM
Thats what I forgot, I forgot the $uploaded_thumbs = part in the loop. I assumed that it was implied that thats what I wanted since thats what was in the loop, but I guess not.... Thanks man!!!!

Oh, since im talkin to ya, that upload/insert behavior that you helped me with a couple weeks ago... you were right, I was making it too complicated... I had an idea of itweaking a php pagination script to do the same thing since that really all it is... stepping though the images one at a time, page by page and insering info into the DB for each...

My app runs much smoother/quicker now and you can actually use the back button!!!!

02-09-2010, 05:54 AM
No probs mate, glad to help.