SoFunction
Updated on 2025-04-05

PHP interview questions, please record them here

Code optimization
Copy the codeThe code is as follows:

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

Copy the codeThe code is as follows:

for($i=0;$i<8;$i++){
$week[]=$arr[$i];
}
//This way there is no additional burden on calling functions

The benefits and disadvantages of indexing
Benefits: When querying, you will first locate the number of rows in the index list at one time, which greatly reduces the number of rows that traverse matched.
Disadvantage: You have to query this table anyway, the fields are repeated a lot of values, and adding an index is meaningless
If there are fewer records, increasing the index will not bring about speed optimization, but instead wastes storage space, because the index requires storage space, and a fatal disadvantage is that for every execution of update|insert|delete, the index of the field must be recalculated and updated.