|
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
Navigation:
[Reply to this message]
|