Reply to Re: Undefined offset- how to prevent warning message?

Your name:

Reply:


Posted by Erlend Klakegg Bergheim on 09/28/12 11:41

Tom Peel skrev:
> Good Man wrote:
>> Tom Peel <notreallytandp@freenet.de> wrote in
>> news:46qs8bFcjg1qU1@individual.net:
>>
>>> This is pretty ugly, because I cannot predict the final size of the
>>> array.
>>> Is there a good solution?
>>
>>
>> if(array_key_exists($k,$constraintuno)) {
>> $constraintuno[$k] .= $s." + ";
>> }
>>
>> might work?
>>
> and if the key doesn't exist? Once again, the point is that I am trying
> to insert an item into an array at a key position that doesn't exist
> yet, and I have no way a priori to know which keys will exist. Surely
> this cannot be so unusual?

if(isset($constraintuno[$k])) {
$constraintuno[$k] .= $s." + ";
} else {
$constraintuno[$k] = $s." + ";
}


--

Vennlig hilsen

Erlend Klakegg Bergheim

[Back to original 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

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