Jump to content

Str replace problems


web2000

Recommended Posts

Hi,

 

I have got the following code to create a new word document and change the characters “” with “” but if the lengths are the same for instance “sam” and “dav” or “rag” and “dfj” it works but if the values are different lengths for eg “sam” “samasma” it doesn’t work

 

Any help?

 

Thanks

 

 

 

$filename = "C:/Webspace/nich/tempdocs/agreement.doc";

 

$f="C:/Webspace/nich/realdocs/test1.doc";

$fp = fopen($f, 'wb');

$fp_temp = fopen($filename, 'rb');

 

global $T_Tenancy;

$rentagreed = $T_Tenancy->rentagreed->GetValue();

 

 

$old_contents = fread ( $fp_temp, filesize ($filename));

fclose ( $fp_temp);

$constants=str_replace("rent754",$rentagreed,$old_contents);

fwrite($fp, $constants);

fclose($fp);

 

Link to comment
https://forums.phpfreaks.com/topic/48344-str-replace-problems/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.