| « 5 Ways to Keep Visitors Coming Back | Artificial Intelligence And Intuition » |
Ok so there´s alot of PHP developers out there, but how many of them actually makes great websites?
Here are a few misstakes i usually have to fix when i take over projects made by other developers.
1) Breaking out variables
Most developers doesn´t do this for some reason, which is a huge misstake since the PHP interpreter have to read the strings more times to determin if there´s a variable in them. In other words you waste CPU time.
2) Calling a function inside a loop comparison
Have you ever made a loop like this:while($count++ < sizeof($array)) {
// do someting
}
If you have, it´s time to stop that bad habbit. This type of coding means that you actually call the sizeof() function each time around in the loop, so if the array got 1000 elements you call sizeof() 1000 times.
It´s better to do it like this:
$total = sizeof($array);
while($count++ < $total) {
//do something
}