Re: delete part of array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux