If you like a more direct approach,
That's a perfectly valid approach, but how is it "more direct"? (And "more direct" that what for that matter?)
You have:
- An auxiliary boolean variable;
- An auxiliary array (... of references which have to be taken);
- Two nested loops;
- A callback function (from a module);
- An array slice;
- n(n+1) dereferences;
- n(n+1)/2 comparisons;
- And it doesn't even short-circuit if the first two variables compared are the same.
That's the strangest definition of "more direct" I can think of :)
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
Of course I agree with all your arguments. All I meant to imply was that it directly compares the variables in question (not copies) and with very little source code. I find it very easy to understand. In general, that should trump issues of speed, memory, or namespace.
| [reply] |
| [reply] [d/l] [select] |