Re: Guidance
| From: | Jochem Maas | Date: | Thu, 28 Feb 2008 01:21:09 +0000 |
| Subject: | Re: Guidance | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270497@lists.php.net to get a copy of this message | ||
Stut schreef:
On 27 Feb 2008, at 23:25, Jochem Maas wrote:that's what they all say ... my thunderbird knows different ;-)Stut schreef:I DID NOT!! It was him! I only schreef in private!
well for the record then (it's late, I'm on my third glass of wine, it could probably be more efficient) ... feel free to use in your next php3 project :-) if (!function_exists('array_reverse')) { function array_reverse($a, $pk = false) { $r = array(); if ($pk) { do { end($a); $v = each($a); $r[ $v[0] ] = $v[1]; } while (array_pop($a) && count($a)); } else { while ($i = array_pop($a)) $r[] = $i; } return $r; } } function ar($a, $pk = false) { $r = array(); if ($pk) { do { end($a); $v = each($a); $r[ $v[0] ] = $v[1]; } while (array_pop($a)); } else { while ($i = array_pop($a)) $r[] = $i; } return $r; }I've interviewed more than my fair share of "web developers" who couldn't reverse an array without using array_reverse if their life depended on it. Sometimes it really does scare me!are there any other restrictions other than not to use array_reverse()? ;-)
Well, implemented in PHP would be nice, but nothing beyond that. There are many different ways to do it.skinacat.com
It's worth noting that I've asked the same question to more than a few interviewees for traditional C/C++ roles, and I never came across one that couldn't do it which I find quite interesting. Incidentally, the same distinction between engineers and developers applies here too, it's certainly not specific to web development.hmm. thing is you need a bit of paper to call yourself an engineer .. I ain't got one.
-Stut