The issue: Often used simple constructs can waste a valid amount of time
- A main usage of webapplications is string processing.
- Look for the most often used constructs in your application
The solution: Simple optimizations can save a lot of time
- Prefer ' over " and save a step of parsing.
<?php
echo 'Hello
world.';
echo "Hello\nworld.";
?>
- Use echo's multiple parameters instead of string concatenation.
<?php
echo 'Hello', $world;
echo 'Hello ' . $world;
?>
- Where possible use ++$i instead of $i++
<?php
for ($i = 0; $i < 1000; $i++);
for ($i = 0; $i < 1000; ++$i);
?>