Re: [PHP] Replace a string in array then re-write line.

2001-03-08 Thread enthalpy
ok that will work for swaping the elements in the array. however rewriting the old line blah:blah:blah to blah:foo:blah its 2 flat files that im opening with fopen obviously. perhaps im talking in circles <-CoreComm-Internet-Services---http://core.com-> (Jon Marshall

Re: [PHP] Replace a string in array then re-write line.

2001-03-08 Thread andrew
You should look at strtr - http://www.php.net/manual/en/function.strtr.php either swap string into 'nother string according to target, or swap array into string, using array fields as target. Also, check preg_replace: http://www.php.net/manual/en/function.preg-replace.php regards, jaxon On 3/8

Re: [PHP] Replace a string in array then re-write line.

2001-03-08 Thread enthalpy
im just using 2 flat files. is there any kind of freplace? or can i use str_replace to re-write the line? <-CoreComm-Internet-Services---http://core.com-> (Jon Marshall CoreComm Services Chicago) ([EMAIL PROTECTED] Systems Engineer II) ([EMAIL PROTECTED]

Re: [PHP] Replace a string in array then re-write line.

2001-03-08 Thread Jaxon
Jon, I've done something similar with strtr(), pulling the array from a database and swapping the result set into a file. $fd = fopen ($file, "r"); $string = fread ($fd, filesize ($template)); fclose ($fd); $array = mysql_fetch_array($result, MYSQL_ASSOC); echo (strtr($string, $array)); just m