|
Posted by Tom Peel on 09/28/37 11:41
I'm getting this message showing up in the apache error_log:
PHP Notice: Undefined offset: 21 in
/usr/local/apache2/htdocs/cargo/lpdriver.php on line 104
The offending code line is:
$constraintuno[$k] .= $s." + ";
This is inside a loop where $k is integer and being being incremented on
each iteration. The final value of $k, and hence the size of array
$constraintuno, is of unknown size.
I can get rid of the error message by using array_fill:
$constraintuno = array_fill(0,1000,'');
This is pretty ugly, because I cannot predict the final size of the array.
Is there a good solution?
Navigation:
[Reply to this message]
|