str_replace() in PHP 4.4

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Fari
Forum Commoner
Posts: 42
Joined: Thu Sep 19, 2002 8:41 pm
Location: Timmins - Ontario

str_replace() in PHP 4.4

Post 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
CONFIQ
Forum Commoner
Posts: 32
Joined: Fri Oct 18, 2002 3:39 pm
Location: Israel - Raanana

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

?>
Fari
Forum Commoner
Posts: 42
Joined: Thu Sep 19, 2002 8:41 pm
Location: Timmins - Ontario

yipp... seems to be working

Post by Fari »

...although what spooks me is that the old version works on another server...lack of consistency?? thanks anyway!
Beans
Forum Commoner
Posts: 49
Joined: Mon Dec 23, 2002 3:06 am
Location: Manila, Philippines
Contact:

Post 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).
Post Reply