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

<?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          
 
c结构体 zval - -!
上一篇:java容器---集合总结


下一篇:CC++初学者编程教程(12) 基于rhel6.3的Oracle数据库学习环境搭建