1.Single Quotation is always faster than Quotation
Because quotation always check the content inside which contain any variable or not. While the Single Quotation is not checked because the content within a single quotation is alway a chain.
2. Loop in PHP
Whenever using loop to browser an element in array. You often use count function to count the number of elements in array. This will make our application become slow because every element in loop we must recall the count function.
Improve by using count outside loop.
<?php
$b = count($a);
for($i=0; $i<=$b; $i++){
// action
}
?>
3. Dont Use Relative Path Folder PHP
Because your system must takes time to search for and sharing the path.That will make the resource-consuming applications in the implementation of this operation.
Improve:
<?php
include BASE.'/path/a.php';
?>
4.Connect the string with a comma "," will be faster than mark "."
PHP programming habits are often connecting Strings and Variables by mark ".". But the fact that the connection strings with a comma ",", will be faster.
5.Always use Single quotes to access key 1 array:
$a = $b['abc']; // faster
No comments:
Post a Comment