Re: delete part of array

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

 



crap - hit 'reply' by mistake.
---

Leif Gregory wrote:

> 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


heh but who says I'm not a bar steward ;-)

> didn't read the manual entry first don't assume they didn't because
> you know what they say about assume.


sorry if it came accross a little harsh, but I stand by the point that the onus is on the person asking the question to give an indication as to what he has done to try and help him/her-self - spoonfeeding is for babies, not programmers.


>
> 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."


happy troll here :-)

>
> 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.


so my point stands - if your going to help why not grab the nearest shell and test by way of a php -r '<test-code>'? takes just along as writing both versions in the mail and makes _you_ look better IMHO.


>
> 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.


indeed it is! thanks for the tip :-) , I might add though that people
choose a close/fast mirror rather than www.php.net itself to help offload some of the traffic - my preferred mirror is always way faster the www.php.net, which is a nice when your hitting the manual 20+ times a day.


BTW: took me a few mins to figure out where to set this: in the bookmarks details dialog (via the bookmark manager - and possibly other routes) if anyone else is interested.

>
>
> 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.


I personally couldn't tell what exactly he wanted to filter out of his array (false, '' or NULL) or whether he cared about the difference in this case. I was merely trying to encourage porper understanding of the function rather than using something which works under the current conditions


>
>
>
> 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