- memory_get_usage: documentation ( source)
- array_fill: documentation ( source)
<?php
function main() {
$res = array_fill(0, 100, array());
$m = memory_get_usage(true);
for ($i = 0; $i < 10000; $i++) {
$res = array();
}
echo "$i operations of \$res+=array() eats: " . (memory_get_usage(true) - $m) . "\n";
}
main();