this fucking function is an example of why people who cannot tell the difference between an array and a hash-table should be shot in the nuts.
Why would you ever want to take the fucking keys of a numerically-indexed array? This function is indistinguishable, on some random array, from "give me n random numbers between 0 and some other number", with 'n' defaulting to 1.
The sad thing is that nobody in the comments page seems to have picked up on this. Instead, the most recent comment starts off talking about unset and goes on to paste a chunk of code that uses the same variable name ("parola") as some two-liner function that was originally posted in 200fucking7 and was hacked on by some third dude in '09.
I mean, on a hash, the function does something vaguely sensible (array_rand is not the most sensible name for a function that says "give me n random keys", but hey). This is why they are different structures, which can have different operations applied to them!
Of course, what am I to expect from a language whose "lambda" operation is a function on two strings that returns a string?
Poorly Hacked Perl
- (no subject)