Stut schreef:
On 27 Feb 2008, at 23:25, Jochem Maas wrote:
Stut schreef:
I DID NOT!! It was him! I only schreef in private!
that's what they all say ... my thunderbird knows different ;-)
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 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;
}
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php