On Wednesday 15 May 2002 05:20, Josh & Valerie McCormack wrote:
> I didn't ask the question about this, but I have a related issue. I'm
> trying to do a replace, and am using str_replace, but the outcome is not
> what I expected.
>
> Here's my code:
>
> <?
> $fp = fopen("new_data.csv", "r");
> $text = fopen("text.txt", "r");
> $merged = fopen("merged_text.html", "w");
> $filecontents = fread($text,filesize("text.txt"));
> while ($data = fgetcsv ($fp, 1000, ",")) {
> $num = count ($data);
> $fullname = $data[0] . ' ' . $data[1];
> $newfullname = '123 ' . $fullname . ' 456';
Remove the above line, it's superfluous.
> $filecontents = str_replace($fullname, "123 $fullname 456", $filecontents);
[snip]
> I only want it to have one set of 123 and 456 on either side. Any ideas?
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
"There is no distinctly American criminal class except Congress."
-- Mark Twain
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php