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                 CoreComm Services Chicago)
([EMAIL PROTECTED]         Systems Engineer II)
([EMAIL PROTECTED]                   Network Operations)
<-----Enthalpy.org-------------http://enthalpy.org----->
([EMAIL PROTECTED]             The World of Nothing)
<------------------------------------------------------>

On Thu, 8 Mar 2001, andrew wrote:

> 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/01 11:32 PM, "enthalpy" <[EMAIL PROTECTED]> wrote:
> 
> > 
> > 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]                   Network Operations)
> > <-----Enthalpy.org-------------http://enthalpy.org----->
> > ([EMAIL PROTECTED]             The World of Nothing)
> > <------------------------------------------------------>
> > 
> > On Thu, 8 Mar 2001, Jaxon wrote:
> > 
> >> 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 my .02:
> >> 
> >> regards,
> >> jaxon
> >> 
> >> 
> >> 
> >> 
> >> On 3/8/01 10:53 PM, "enthalpy" <[EMAIL PROTECTED]> wrote:
> >> 
> >>> 
> >>> ok so im using fopen to read a file split each line in to an array. Check
> >>> those variables against the same situation with a different file. Replace
> >>> a string in the second file with a string in the first file. Then rewrite
> >>> the line with the new variable.
> >>> 
> >>> here is a small example of how im opening and exploding the lines
> >>> 
> >>> $fpoint1 = fopen ($newfile,"r") or die("couldnt open working file");
> >>> while ($data = fgetcsv ($fpoint1, $newfilesize, " ")) {
> >>>     $num = count ($data);
> >>>     echo "$num fields in line $row: \n";
> >>>     for ($c=0; $c<$num; $c++) {
> >>> 
> >>>     }
> >>> 
> >>> im opening the second file the same way and if data[0] and data2[0] are =
> >>> then it will replace the strings.
> >>> 
> >>> anyway if i made any sense at all i think you will know what im talking
> >>> about.
> >>> 
> >>> <-----CoreComm-Internet-Services---http://core.com----->
> >>> (Jon Marshall                 CoreComm Services Chicago)
> >>> ([EMAIL PROTECTED]         Systems Engineer II)
> >>> ([EMAIL PROTECTED]                   Network Operations)
> >>> <-----Enthalpy.org-------------http://enthalpy.org----->
> >>> ([EMAIL PROTECTED]             The World of Nothing)
> >>> <------------------------------------------------------>
> >>> 
> >> 
> >> 
> > 
> > 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to