Write down the problems encountered in php interviews here_PHP Tutorial

WBOY
Release: 2016-07-21 15:28:23
Original
934 people have browsed it

Code optimization

Copy code The code is as follows:

for($i=0;$i<8;$i++){
array_push($week,$arr);
}

Copy code The code is as follows:

for($i=0;$i<8;$i++){
$week[]=$arr[$i];
}
//This way there is no need to call the function The additional burden

The benefits and disadvantages of indexing
Benefits: When querying, the number of rows with a specific value will be located in the index list at one time, greatly reducing traversal Number of matching rows
Disadvantages: This table has to be queried no matter what, and there are a lot of duplicate values ​​in the fields. It is meaningless to add indexes.
There are relatively few records. Adding indexes will not bring about speed optimization but will waste storage space. , because the index requires storage space, and a fatal disadvantage is that for each execution of update|insert|delete, the index of the field must be recalculated and updated.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323587.htmlTechArticleCode optimization copy code The code is as follows: for($i=0;$i8;$i++){ array_push($ week,$arr); } Copy the code as follows: for($i=0;$i8;$i++){ $week[]=$arr[$i]; } //This way there is no need to call the function...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template