I am trying to create an array with PHP. The size of the array is 26000 x 26000. Is it possible to make the array so large? I'm already trying to create an array of size 10000 x 10000, but the program continues to tell me about it:
Fatal error: Out of memory (1886388224 allocated) (tried to allocate 24 bytes) in C: \ xampp \ htdocs \ matrix \ index.php on line 24
I have 8GB RAM, I already set memory_limit in php.ini with -1 (apache configuration). The code for assembling the array is as follows:
function zeros($rowCount, $colCount) { $matrix = array(); for ($rowIndx=0; $rowIndx<$rowCount; $rowIndx++) { $matrix[] = array(); for($colIndx=0; $colIndx<$colCount; $colIndx++) { $matrix[$rowIndx][$colIndx]=0; } var_dump(memory_get_usage()); } return $matrix; } $matrix = zeros(25000,25000);
I am also already trying to use SplFixedArray, but the result is the same. Please help me, thanks! :)
source share