1、If a method can be static, declare it static. Speed improvement is by a factor of 4.
1、如果一个函数可以声明为静态的,那么就用静态的,速度是改进的一个因素4.
2、# Avoid magic like __get, __set, __autoload
2、避免使用__get, __set, __autoload等魔术函数
3、require_once() is expensive
3、require_once()是相当昂贵的。
4、Use full paths in includes and requires, less time spent on resolving the OS paths.
4、用include和require时,尽量用全路径,可以减少花在解决OS路径的时间
5、If you need to find out the time when the scrīpt started executing, $_SERVER[’REQUEST_TIME’] is preferred to time()
5、如果你需要知道一个脚本的开始运行时间,用 $_SERVER[’REQUEST_TIME’]比用time()要好
6、See if you can use strncasecmp, strpbrk and stripos instead of regex
6、如果可以用strncasecmp, strpbrk and stripos就别用正则
7、preg_replace is faster than str_replace, but strtr is faster than preg_replace by a factor of 4
7、preg_replace比str_replace要快,但是strtr比preg_replace更快
8、If the function, such as string replacement function, accepts both arrays and single characters as arguments, and if your argument list is not too long, consider writing a few redundant replacement statements, passing one character at a time, instead of one line of code that accepts arrays as search and replace arguments.
一些函数,比如字符串替换函数,接受数组和单个字符做为参数,并且如果你的参数列表不是很长,考虑写一些冗余替换语句,每次传送一个字符,代替一行代码接受数组做为查找和替换的参数。
9、Error suppression with @ is very slow.
9、禁止错误输出符号@是非常慢的。
10、$row[’id’] is 7 times faster than $row[id]
10、、$row[’id’]比 $row[id]快7倍
11、Error messages are expensive
11、错误信息是非常昂贵的
12、Do not use functions inside of for loop, such as for ($x=0; $x 12、不要在循环内部使用函数,比如: for ($x=0; $x
对于模板,你是否在用smarty?这可能是保证把最经常访问的页面缓存起来的最快的方法了。

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SublimeText3 Linux新版
SublimeText3 Linux最新版

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

WebStorm Mac版
好用的JavaScript開發工具

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具