|
Posted by Jerry Stuckle on 07/15/06 19:31
vito wrote:
>>>> $a[$i] = array();
>>>
>>>Is the above declaration legitimate?
>>
>>as long as $a is defined as an array, yes.
>>
>
>
> $array = array();
>
> for ($k = 0; $k < 10000; $k++)
> $array[$k] = array();
>
> for ($j = 0; $j < 10000; $j++)
> for ($k = 0; $k < 3; $k++)
> $array[$j][$k] = 0;
>
> How to initialize?
>
> $array[$i][1] = $array[$i][1] . $line;
> PHP Notice: Undefined offset: 2700 in array.php on line 24
>
>
Well, in this case you're trying to initialize 10,000 * 10,000 arrays,
each with an integer. On a 32 bit system that's something like
400,000,000 bytes (close to 400 mb) of storage plus the overhead of the
arrays themselves. Probably a bit more than you have available - the
default is around 8M.
Why would you ever try to initialize this much memory (in either PHP or
C/C++) anyway?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|