- microtime: documentation ( source)
- debug_backtrace: documentation ( source)
- str_repeat: documentation ( source)
- round: documentation ( source)
- memory_get_usage: documentation ( source)
<?php
function test($str) {
test2($str);
}
function test2($str) {
test3($str);
}
function test3($str) {
echo "before: ".round(memory_get_usage()/1024/1024, 2)." MB\n";
$t = microtime(true);
debug_backtrace(false);
echo "time: ".(microtime(true)-$t)." ms\n";
echo "after: ".round(memory_get_usage()/1024/1024, 2)." MB\n";
}
test(str_repeat('a', 10000000));