RE: [PHP] Perl Splice Equivalent
| From: | Don Read | Date: | Wed, 25 Jul 2001 18:11:33 +0000 |
| Subject: | RE: [PHP] Perl Splice Equivalent | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-59588@lists.php.net to get a copy of this message | ||
On 25-Jul-2001 Steven Michaels wrote:
> Hello,
> I've been wanting to open a file, read its contents,
> and if one line matches my text, have the program
> remove that line. The file is in this format (a common
> text file.):
> User1
> User2
> User3
> What I want the program to do is to go through each
> line, and if that line matches User2, then have it
> delete it, so the finished text file would be
> User1
> User3
> The problem is that I can't find an equivalent of
> splice in perl, and that was what I used before
> to do this. Could someone help me out?
> Thanks!
PHP4:
array_splice()
PHP3: untested stab:
unset($user[1]);
unset($user['User2']);
Regards,
--
Don Read dread@texas.net
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.