|
Posted by Ulf Kadner on 08/22/07 11:00
pakalk wrote:
> $tmp = array_keys( $input );
> echo $tmp[0], $tmp[2];
Bad code!
You have always to check if array keys exists before accessing it!
There is no warranty that key 2 exists. Never...
Otherwise you become a error when accessing invalid keys.
$tmp = array_keys($input);
if (sizeof($tmp) >= 3)
echo $tmp[0], $tmp[2];
else
// do alternating things
So long, Ulf
--
_,
_(_p> Ulf [Kado] Kadner
\<_)
^^
Navigation:
[Reply to this message]
|