You are here: Re: [PHP] delete part of array « PHP « IT news, forums, messages
Re: [PHP] delete part of array

Posted by Leif Gregory on 01/13/05 14:39

Hello Jochem,

Wednesday, January 12, 2005, 8:08:09 PM, you wrote:
JM> read the manual entry first (see below) - and understand what the
JM> function actually does - never just assume because its giving you
JM> the result you want now that it will always work the way you
JM> expect.

Don't be a 'tard... Just because someone doesn't explicitly state they
didn't read the manual entry first don't assume they didn't because
you know what they say about assume.

So to make a troll happy, here's exactly what it does with one array
given as an argument:

"If only one array is given and the array is numerically indexed, the
keys get reindexed in a continuous way."

Wow... Oddly enough that sounds exactly like what he wanted, and hence
my suggesting it to him.

JM> you think???

Now.. On to the part where the "I think" applies.. Since they do not
give an example of a single array being used as an argument, I had to
rely on memory from when I needed to do that nearly four months ago.

I know I used array_merge(), but I didn't remember if I had to assign
it to a variable or not.

JM> hit the manual: http://www.php.net/array_merge (thats 30 chars to
JM> type in the addressbar of your favorite browser and then you'd be
JM> sure)

No duh.... and if you're using Firefox, you can even do something
really weird like give the php.net website a keyword (oh, "php" seems
to work nicely), and set your location to "http://www.php.net/%s" and
amazingly enough you can just type in "php array_merge" and
automagically it takes you right there. That's only 15 chars... Much
more efficient than your suggestion.


JM> probably array_merge() will do what he wants but there maybe
JM> side-effects that will bite him in the ass later on, same goes for
JM> my (previous) suggestion of array_values() as it happens <blush>.

His array is numerically indexed. It does exactly what he wants.



Cheers,
Leif Gregory

--
TB Lists Moderator (and fellow registered end-user)
PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F
Web Site <http://www.PCWize.com>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация