- memory_get_peak_usage: documentation ( source)
- array_fill: documentation ( source)
<?php
$max = 100;
$arr = array_fill(0, $max, 1);
//$mem = memory_get_usage(true);
foreach ($arr as $key=>$val)
{
$arr[$max+1] = 9999;
}
echo memory_get_peak_usage();