Archive

Posts Tagged ‘code’

Optimize your PHP Code – Tips, Tricks and Techniques

October 24th, 2008
    [googmonify]2908853635:center:468:60[/googmonify]

  1. If a method can be static, declare it static. Speed improvement is by a factor of 4
  2. echo is better than print
    [sourcecode language='php']
    echo( ‘CHECKMATE: PLAY with PROBLEMS’ );
    // is better than
    print( ‘CHECKMATE: PLAY with PROBLEMS’ );
    [/sourcecode]
  3. Use echo’s multiple parameters instead of string concatenation
    [sourcecode language='php']

$@!ful PHP , , , , , , , ,