码迷,mamicode.com
首页 > Web开发 > 详细

php的内存分配还是很智能的

时间:2016-08-09 00:04:49      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:

<?php

echo memory_get_usage().PHP_EOL;
$a = 1;
$b = $a;
echo memory_get_usage().PHP_EOL;

 

<?php

echo memory_get_usage().PHP_EOL;
$a = 1;
$b = 1;
echo memory_get_usage().PHP_EOL;

第一个比第二个省内存

PS D:\WWW\php-> php .\memery_get_usage.php                                                                   
225664                                                                                                       
225936                                                                                                       
PS D:\WWW\php->                                                                                              
PS D:\WWW\php-> php .\memery_get_usage.php                                                                   
225696                                                                                                       
226032          

php的内存分配还是很智能的

标签:

原文地址:http://www.cnblogs.com/a-flydog/p/5751406.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!