Home  >  Article  >  Backend Development  >  求解变量的实施方式

求解变量的实施方式

WBOY
WBOYOriginal
2016-06-13 13:06:40873browse

求解变量的执行方式
我有一个变量是通过自定义函数复杂运算才得来的,比较耗资源..

我想知道是不是只有当这个变量要用到的时候才会去执行,还是页面一加载就把这个变量给算出来了?

如果是后面一种情况我好把这个变量放在判断语句中,也好节省些资源

另外对象的执行也跟变量一样吗?

------解决方案--------------------
程序是顺序执行的,只要运行到哪里便分配内存。

你可做成函数形的,因为函数不调用不会运行。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn