- memory_get_peak_usage: documentation ( source)
- array_chunk: documentation ( source)
<?php
$arr = array();
for ($i = 0; $i < 100000; $i++) {
$arr[] = array("foo" => $i, "bar" => $i);
}
print(memory_get_peak_usage() . "\r\n");
$arr_chunked = array_chunk($arr, 100);
print(memory_get_peak_usage() . "\r\n");