I’m using a regular loop but when I put in a large data in the loop it doesn’t work, is their any way I can do to put large data in an array?
$arr = array('Joe', 'Jack');
$arr2 = array();
foreach($arr as $val){
$arr2[] = $val;
}
print_r($arr2);
So when the $arr is too large i’m getting a no data received error in the browser,
Any help appreciated.
You probably want to look at more lightweight SplFixedArray. It uses a regular contiguous memory block to store the data, as opposed to the traditional hash structure.
The second way is to play with memory_limit parameter, but it is not good idea
The third way is to spit your array in chunks