功能很好.
我看到功能徽標()比$logo更好. echo不占用太多內存,但$logo確實如此.即使函數logo()需要一些東西,它也將由PHP自己的垃圾收集器處理.您還可以使用這些函數來確保不會濫用分配的內存.
> memory_get_peak_usage();
> memory_get_usage();
說明:
Upon the ending of an in use function PHP clears the memory it was using, at least more efficiently than if not using a function. If you are using recursive code or something similar that is memory intensive try putting the code into a function or method, upon closing of the function/method the memory used for the function will be garbaged much more efficiently than that of unsetting variables within the loop itself.