Page 1 of 1

str_replace() in PHP 4.4

Posted: Tue Mar 04, 2003 6:25 pm
by Fari
Hi

I'm running Apache 2.0.43 with PHP 4.4.0 version and for some silly reason str_replace() does not work ... this simle code

Code: Select all

$temp = $rowї$i];
str_replace( "tmp" , "jpg" , $temp );	
echo"<img src="image_reduce.php?to_be_reduced=$temp">";
which takes a file name with a phpxxx.tmp name and converts it to phpxxx.jpg so the display routine can read the jpg file for soem reason does not work. Any ideas why? has anyone else had the same problem???

Ta - Frank

Posted: Tue Mar 04, 2003 6:53 pm
by CONFIQ
There is PHP4.4.0??perhaps you meant 4.3.1.
any way,try this

Code: Select all

<?php 
$temp = str_replace("tmp","jpg",$row[$i]);    
echo"<img src="image_reduce.php?to_be_reduced=$temp">"; 
?>

?>

yipp... seems to be working

Posted: Tue Mar 04, 2003 10:00 pm
by Fari
...although what spooks me is that the old version works on another server...lack of consistency?? thanks anyway!

Posted: Tue Mar 04, 2003 11:11 pm
by Beans
You sure it worked on previous versions? str_replace is a function, and as such, it need to be assigned to a variable or placeholder (in this case, your $temp).