Formatting php, what works more efficiently?
- by JamesM-SiteGen
Hello fellow programmers,
I was just wondering what makes php work faster, I have a few methods that I always go and do, but that only improves the way I can read it, but how about the interpreter?
Should I include the curly braces when there is only one statement to run?
if(...){
    echo "test";
}
# Or..
if(...)
    echo "test";
=== Which should be used?
I have also found http://beta.phpformatter.com/ and I find the following settings to be good, but are they?
  Indentation:
  
  Indentation style: {K&R (One true brace style)}
  Indent with: {Tabs}
  Starting indentation: [1]
  Indentation: [1]
  
  Common:
  
  [x] Remove all comments
  [x] Remove empty lines
  [x] Align assignments statements nicely
  [ ] Put a comment with the condition after if, while, for, foreach, declare and catch statements
  
  Improvement:
  
  [x] Remove lines with just a semicolon (;)
  [x] Make normal comments (//) from perl comments (#)
  [x] Make long opening tag (<?php) from short one (<?)
  
  Brackets:
  
  [x] Space inside brackets- ( )
  [x] Space inside empty brackets- ( )
  [x] Space inside block brackets- [ ]
  [x] Space inside empty block brackets- [ ]
  
  Tiny var names:
often I go through my code and change $var1 to $a, $var2 to $b and so on. I do include comments at the start of the file to show to me what each letter(s) mean..
Final note:
So am I doing the right thing with the curly braces and the settings?
Are there any great tips that help it run faster?