|
Posted by Tom Peel on 09/28/42 11:41
Erlend Klakegg Bergheim wrote:
> 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." + ";
> }
>
>
Ok, if I understand correctly, the problem is that the '.=' is
equivalent to having the variable on the right hand side, and the
warning is about accessing an undefined variable?
T.
Navigation:
[Reply to this message]
|