Code snippets, tech tricks and other bits and bobs

52 coding tips for improved PHP performamce

An interesting collection of tips over at joomlaperformance.com

Some of the best:

  • Operating on an initialized variable is 376% faster than operating on an unitialized variable.
  • Constants are 146% slower than variables
  • Local variables are 9.9% faster than global variables
  • 'String'.$var is 28% faster than "String$var"
  • isset($array[$key]) is 230% faster than array_key_exists()
  • file_get_contents() is 52% faster than fopen(), fread(), fclose()
  • @Error supression is 235% slower than without
  • require_once() is 24% faster than include()
  • include(relative path) is 37% faster than include(full path)

Learning to use these tips could significantly speed your code.

52 PHP Programming Tips

 

Filed under  //   PHP   Performance