";
foreach ($input as $key => $value) {
$input[$key] = null;
}
echo "function1-end:" . (xdebug_memory_usage() - $GLOBALS['startMemory']) . " bytes \n
";
return $input;
}
function test4_ref(&$input) {
echo "function2-begin:" . (xdebug_memory_usage() - $GLOBALS['startMemory']) . " bytes \n
";
foreach ($input as $key => $value) {
$input[$key] = null;
}
echo "function2-end:" . (xdebug_memory_usage() - $GLOBALS['startMemory']) . " bytes \n
";
}
$GLOBALS['startMemory'] = xdebug_memory_usage();
echo "start:" . (xdebug_memory_usage() - $GLOBALS['startMemory']) . " bytes \n
";
$array = range(1, 100000);
echo "array:" . (xdebug_memory_usage() - $GLOBALS['startMemory']) . " bytes \n
";
$array = test4($array);
echo "array-test4:" . (xdebug_memory_usage() - $GLOBALS['startMemory']) . " bytes \n
";
test4_ref($array);
echo "array-test4_ref:" . (xdebug_memory_usage() - $GLOBALS['startMemory']) . " bytes \n
";
echo "end:" . (xdebug_memory_usage() - $GLOBALS['startMemory']) . " bytes \n
";