On Wed, 5 Mar 2003, Richard Kurth wrote:

> This script will remove a line from a text list of email address and
> then re-write the list. The only problem I am having is when it
> re-writes the list it adds a extra line between each record. How can I
> stop this from happening

Your code works as you'd expect ... on my mod_php 4.2.2 & Apache 1.3.26
setup.  It's amazing though, because implode() is used incorrectly.
See below:

> $recordsarray = file($members);
> $remove = "[EMAIL PROTECTED]";
> $temp = array();
> for ($i=0;$i<count($recordsarray);$i++)
> {
>   if (!strstr($recordsarray[$i], $remove))
>   {
>     $temp[] = $recordsarray[$i];
>   }
> }
> $recordsarray = $temp;
> $lines = implode($recordsarray,'');

The above line:
I'm assuming you want to collapse $recordsarray into a sting, with the
elements of $recordsarray separated by a null char.  Well, you told
implode() to collapse a null char into a string with the elements of null
char separated by $recordsarray ... inverted the arguments to implode().
I have no idea why an error isn't raised instead of kind-of working, but
anywho ....

Try switching the arguments around in the call to implode(), to:
$lines = implode('',$recordsarray);

http://www.php.net/manual/en/function.implode.php

If that doesn't correct the problem you're experiencing, let us know.
I have other ideas for you, but they may not be necessary if that solves
it.

        HTH,
        ~Chris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to