1, replace i=i+1 with I+=1. It is more efficient to conform to the C + + habit.
2. Use PHP internal function as much as possible. Write your own function before you need to consult the manual to see if there are related functions, otherwise thankless.
3, can use single quotation mark string to use single quote string as far as possible. Single quote strings are more efficient than double quote strings.
4, using foreach instead of while traversing the array. When traversing an array, foreach is significantly more efficient than the while loop and does not need to call the Reset function. The two traversal methods are as follows:
Reset ($arr);
while (the list ($key, $value) = each ($arr)) {
echo "Key: $key; Value: $value <br>n ";
}
foreach ($arr as $key => $value) {
echo "Key: $key; Value: $value <br>n ";
}
The above points have been tested by the author, the deficiencies, please more correct.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.