You are here: Re: array keys « PHP Programming Language « IT news, forums, messages
Re: array keys

Posted by Ulf Kadner on 08/22/07 15:46

ZeldorBlat wrote:
> On Aug 22, 7:00 am, Ulf Kadner <dr_lo...@gmx.net> wrote:
>> 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.

Not fine ;-)

> $a = array('foo' => 0, 'bar' => 1, 'baz' => 2);
> $tmp = array_keys($a);
>
>>From that I'll be happy to warrant that $tmp[2] exists.

The op dont says how the array was build. So its usefull to check always
if it comes with the required data. If you dont doit, your problem.

--
_,
_(_p> Ulf [Kado] Kadner
\<_)
^^

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация