for($i=0;$i<count($array);$i++){/* do something */}
instead, do this:
$num=count($array);for($i=0;$i<$num;$i++){/* do something */}
include only files that you need; split the functions into more files if they are not always used together
if using a database, use persistent connections
don't use a regular expression when a simple string-manipulation function will do the job; for example, to turn one character into another in a string, use str_replace(), not preg_replace().