Log in

View Full Version : Optimizing Code



TheCase
08-26-2008, 11:08 AM
Hi,

What things make code use less resources and load faster do things like using ' ' when there is no variable and " " when there is and exit; instead of exit(); do theses make difference?

Twey
08-26-2008, 04:47 PM
The latter doesn't. The former makes a slight difference: single quotes are always faster than double quotes, even if you're concatenating in a variable or (I think) using sprintf (http://www.php.net/sprintf)(), which is neater. There are usually bigger things to worry about, though.

Nightfire
08-27-2008, 01:47 AM
Just be sensible in what you do. Don't use php to echo out millions of lines of html for just one variable to say 'hi' in. Make sure loops aren't looping more than they should. Mainly it'll be database design which will be more obvious to resources being used.