Re: [PHP] Removing a row from an Array

2007-06-08 Thread Ken Kixmoeller -- reply to [EMAIL PROTECTED]


On Jun 5, 2007, at 5:20 PM, Richard Lynch wrote:


am I missing something (other than a few brain cells)?


http://php.net/unset

As in, unset($array['goner']);


Yup, that's the one. Thanks to you, too.

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



Re: [PHP] Removing a row from an Array

2007-06-05 Thread Richard Lynch
On Mon, June 4, 2007 2:13 pm, Ken Kixmoeller -- reply to
[EMAIL PROTECTED] wrote:
 Hey - - - - - - --

 To do this, I am:

   - looping through the array
   - copying the rows that I want to *keep* to a temp array, and
   - replacing the original array with the temp' one.

 Seems convoluted, but I couldn't find any function to remove a row of
 an array. Am I missing something (other than a few brain cells)?

http://php.net/unset

As in, unset($array['goner']);

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Removing a row from an Array

2007-06-04 Thread Jay Blanchard
[snip]
To do this, I am:

  - looping through the array
  - copying the rows that I want to *keep* to a temp array, and
  - replacing the original array with the temp' one.

Seems convoluted, but I couldn't find any function to remove a row of  
an array. Am I missing something (other than a few brain cells)?
[/snip]

http://us2.php.net/manual/en/function.array-pop.php

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



RE: [PHP] Removing a row from an Array

2007-06-04 Thread Peter Lauri
Using array_pop wouldn't do it, as it just removes the last element.

You could use unset() for the rows you don't want to keep.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


 -Original Message-
 From: Jay Blanchard [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 04, 2007 9:25 PM
 To: Ken Kixmoeller -- reply to [EMAIL PROTECTED]; php-
 [EMAIL PROTECTED]
 Subject: RE: [PHP] Removing a row from an Array
 
 [snip]
 To do this, I am:
 
   - looping through the array
   - copying the rows that I want to *keep* to a temp array, and
   - replacing the original array with the temp' one.
 
 Seems convoluted, but I couldn't find any function to remove a row of
 an array. Am I missing something (other than a few brain cells)?
 [/snip]
 
 http://us2.php.net/manual/en/function.array-pop.php
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

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



Re: [PHP] Removing a row from an Array

2007-06-04 Thread Ken Kixmoeller -- reply to [EMAIL PROTECTED]


On Jun 4, 2007, at 2:25 PM, Jay Blanchard wrote:


http://us2.php.net/manual/en/function.array-pop.php


Thanks, Jay ---

I did see that function, but forgot about it when I asked the  
question. I should have added that *any* array row among many could  
be the one that needs to be removed. I couldn't figure out how to  
reorder the array so that POP would work.


Ken

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



Re: [PHP] Removing a row from an Array

2007-06-04 Thread Ken Kixmoeller -- reply to [EMAIL PROTECTED]


On Jun 4, 2007, at 3:29 PM, Peter Lauri wrote:



You could use unset() for the rows you don't want to keep.



Ah --- yes, that looks like it would do it. I was expecting something  
to find something array-specific.


Thank you, Pater and Roberto

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