|
Posted by ZeldorBlat on 08/22/07 13:02
On Aug 22, 7:00 am, Ulf Kadner <dr_lo...@gmx.net> wrote:
> 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.
>
I disagree.
$a = array('foo' => 0, 'bar' => 1, 'baz' => 2);
$tmp = array_keys($a);
>From that I'll be happy to warrant that $tmp[2] exists.
Navigation:
[Reply to this message]
|