Re: remove keys from array
| From: | Rabin Vincent | Date: | Sun, 11 Jun 2006 19:02:18 +0000 |
| Subject: | Re: remove keys from array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237767@lists.php.net to get a copy of this message | ||
On 6/11/06, Ahmed Abdel-Aliem <me2resh@gmail.com> wrote:
when i have array in the form of : Array ( [0] => 2 [ID] => 2 [1] => asdasd [CategoryName] => asdasd ) ) how can i make it in the form of : Array ( [ID] => 2 [CategoryName] => asdasd ) )To remove a single element you can use unset: unset($arr[0]);. To remove all the elements with integer indices you could just loop, check, and unset those ones. What do you need to do this for? Your examples looks like arrays got from mysql_fetch_array. If this is so, using mysql_fetch_assoc() instead of that will get you only the associative array. Rabin