- str_repeat: documentation ( source)
- memory_get_usage: documentation ( source)
- ini_set: documentation ( source)
- error_reporting: documentation ( source)
<?php
ini_set("display_errors","On");
error_reporting(E_ALL);
function without($var){
echo "Certain death\n";
$var.='die fucker DIE!';
echo memory_get_usage(), PHP_EOL;
}
function with(&$var){
echo "Alive\n";
echo memory_get_usage(), PHP_EOL;
}
$str = str_repeat('foo', 10000000);
echo memory_get_usage(), PHP_EOL;
echo "END\n";
with($str);
without($str);