One simple optimization that most people miss is not using count($var) as a condition of for loops.
PHP Code:
// Wrong
for ($i = 0; $i < count($Results); $i++)
{
// Do Something
}
It’s very simple, and now you’re not counting the size of the stack every time you process the loop.PHP Code:
// Correct
$ResultCount = count($Results);
for ($i = 0; $i < $ResultCount; $i++)
{
// Do Something
}
Bookmarks