<?php call_user_func(function(){ echo 'val_val' . PHP_EOL; $a = range(1, 100000); $m = memory_get_usage(); $b = $a; $c = $b; echo ' memory usage: ' . number_format(memory_get_usage() - $m) . PHP_EOL; }); call_user_func(function(){ echo 'ref_val' . PHP_EOL; $a = range(1, 100000); $m = memory_get_usage(); $b = &$a; $c = $b; echo ' memory usage: ' . number_format(memory_get_usage() - $m) . PHP_EOL; }); call_user_func(function(){ echo 'val_ref' . PHP_EOL; $a = range(1, 100000); $m = memory_get_usage(); $b = $a; $c = &$b; echo ' memory usage: ' . number_format(memory_get_usage() - $m) . PHP_EOL; }); call_user_func(function(){ echo 'ref_ref' . PHP_EOL; $a = range(1, 100000); $m = memory_get_usage(); $b = &$a; $c = &$b; echo ' memory usage: ' . number_format(memory_get_usage() - $m) . PHP_EOL; });
You have javascript disabled. You will not be able to edit any code.