|
Posted by Ron Eggler @ work on 06/17/05 16:26
Ron Eggler @ work wrote:
> Kimmo Laine wrote:
>> "Ron Eggler @ work" <nospam@hotmail.com> kirjoitti
>> viestissδ:3hcgm7Fga8fmU1@individual.net...
>>> Hi,
>>>
>>> I got a textfile with e-mail addresses on every line. now I want to
>>> be able
>>> to delete one e-mail-address from this file and shift everything
>>> below one line up. how do I do that?
>>> Thank you! :)
>>
>> <?php
>> // Read the file into an array. One address per row
>> $emails = file("emails.txt");
>> // Remove given email address
>> unset($emails[array_search($email_address)]);
>> // Change array back to end-of-line separated string, write to file
>> file_put_contents("emails.txt", implode("\r\n", $emails));
>> // In, out, wipe the tool, say "thank you", and leave. Simple and
>> easy.
>
> Oh thank you very much! :)
> But I get these Messages:
>
> Warning: Wrong parameter count for array_search() in
> /srv/www/htdocs/web2/html/php/nospam/pop.php on line 31
>
> Fatal error: Call to undefined function: file_put_contents() in
> /srv/www/htdocs/web2/html/php/nospam/pop.php on line 33
ah: php_info() says:
PHP Version 4.3.3
and file_put_contents() need php5. how to do it with php 4.3.3?
Thank you! :)
[Back to original message]
|