php基础教程之优化PHP程序的方法的了解能让大家明白PHP程序的应用方法。北大青鸟武汉宏鹏鲁广校区老师为大家介绍优化PHP程序的方法。
php基础教程之1. If a method c++an be static, declare it static. Speed improvement is by a factor of 4. 如果一个方法可静态化,就对它做静态声明。速率可提升至4倍。
php基础教程之2. echo is faster than print. echo 比 print 快。
php基础教程之3. Use echo's multiple parameters instead of string concatenation. 使用echo的多重参数(译注:指用逗号而不是句点)代替字符串连接。
4. Set the maxvalue for your for-loops before and not in the loop. 在执行for循环之前确定大循环数,不要每循环一次都计算大值。
5. Unset your variables to free memory, especially large arrays. 注销那些不用的变量尤其是大数组,以便释放内存。
6. Avoid magic like __get, __set, __autoload 尽量避免使用__get,__set,__autoload.
7. require_once() is expensive require_once()代价昂贵。
8. Use full paths in includes and requires, less time spent on resolving the OS paths. 在包含文件时使用完整路径,解析操作系统路径所需的时间会更少。
9. If you need to find out the time when the script started executing, $_SERVER['REQUEST_TIME'] is preferred to time() 如果你想知道脚本开始执行(译注:即服务器端收到客户端请求)的时刻,使用$_SERVER['REQUEST_TIME']要好于time()。
10. See if you can use strncasecmp, strpbrk and stripos instead of regex. 检查是否能用strncasecmp,strpbrk,stripos函数代替
- 上一篇:没有了
- 下一篇:基于php的curl学习
大家都在看的前端技术教程
最新发布前端技术教程
- 03-02北大青鸟学Web前端需要多久?
- 02-25北大青鸟大数据专业怎么样?
- 12-032020年学web前端能赚到钱吗?
- 11-15大学生适合学北大青鸟web前端吗?
- 11-05大学生去北大青鸟学web前端有前景吗?
- 11-01去北大青鸟电脑学校学web前端课程好不好?北大青鸟课程
- 10-23武汉计算机学校学web前端怎么样?
- 08-28北大青鸟学前端好就业吗?就业前景如何?
- 07-27在北大青鸟多长时间能学完Web前端?
- 11-07云顶国际web前端开发课程给你新思路!
- 09-03云顶国际web前端开发课程
- 10-15php基础教程之优化PHP程序的方法
- 03-12用PHP制作的意见反馈表
- 12-29PHP和MY SQL保存和输出图片
- 12-29PHP如何生成静态页面详解
- 12-29PHP初学者常见的十四个问题总结
- 12-29PHP技巧如何通过COM使用ADODB
- 12-29PHP MYSQL身份验证的方法
- 12-25PHP配置文件的权限系统设置
- 12-25php使用curl或fsockopen下载远程图片