<?php
echo $m1 = memory_get_usage();
echo "<br />";
$var_string = "123";
echo $m2 = memory_get_usage()-$m1;
echo "<br />";
echo $m3 = memory_get_usage()-$m1-$m2;
echo "<br />";
echo $m4 = memory_get_usage()-$m1-$m2-$m3;
echo "<br />";
echo $m5 = memory_get_usage()-$m1-$m2-$m3-$m4;
?>
结果:217288 320 136 136 136 怎么搞的,获取的不都是字符串类型吗?怎么会不一样了?
<?php echo $m1 = memory_get_usage(); echo "<br />"; $var_string = "123"; echo $m2 = memory_get_usage()-$m1; echo "<br />"; echo $m3 = memory_get_usage()-$m1-$m2; echo "<br />"; echo $m4 = memory_get_usage()-$m1-$m2-$m3; echo "<br />"; echo $m5 = memory_get_usage()-$m1-$m2-$m3-$m4; ?>
我试了下,没错啊。向上面这样的话结果是
217288
320
136
136
136
<?php echo $m1 = memory_get_usage(); echo "<br />"; $var_string = "123"; echo $m2 = memory_get_usage()-$m1; echo "<br />"; $n=123; echo $m3 = memory_get_usage()-$m1-$m2; echo "<br />"; $f=123.00; echo $m4 = memory_get_usage()-$m1-$m2-$m3; echo "<br />"; $var_array = array("123"); echo $m5 = memory_get_usage()-$m1-$m2-$m3-$m4; ?>
赋值给它什么就是什么类型的