Re: delete part of array
| From: | Jochem Maas | Date: | Thu, 13 Jan 2005 03:08:09 +0000 |
| Subject: | Re: delete part of array | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-206266@lists.php.net to get a copy of this message | ||
Leif Gregory wrote:
Hello Sebastian, Wednesday, January 12, 2005, 5:22:20 PM, you wrote: S> how do i delete keys from an array if it has no values? S> eg, this: array_merge($name); Try it that way first. If not,read the manual entry first (see below) - and understand what the function actually does - never just assume because its giving you the result you want now that it will always work the way you expect.
$name = array_merge($name); But I think I remember the first way working for me.you think??? hit the manual: http://www.php.net/array_merge (thats 30 chars to type in the addressbar of your favorite browser and then you'd be sure) probably array_merge() will do what he wants but there maybe side-effects that will bite him in the ass later on, same goes for my (previous) suggestion of array_values() as it happens <blush>. a tip for those who don't already know: php.net (and its mirrors (I usually use nl2.php.net)) have a great search mechanism: http://www.php.net/<function-name> replace <function-name> with the name of function your interested in and boom your right at the page you need! actually other keywords work as well. for instance: need to know more about arrays: http://www.php.net/array or mysql http://www.php.net/mysql or overloading http://www.php.net/overload even when you don't know the exact keyword to use, your guess will often get you where you want! <BLATANT-PROMO> nl2.php.net is the best php mirror out there *obviously*, nothing to do with the fact that the guys that run it are friends of mine, or the fact that they do such a great job at hosting alot of the sites I build/run/own ;-) [www.nedlinux.nl: linux freaks with a lowlands twist] </BLATANT-PROMO>
Cheers, Leif Gregory