The best thing to do is experimentation - set up a loop that tests each alterantive N thousand times and see how long they take. YMMV. A few general things:
preg is faster than ereg. With preg's PCRE syntax, the regex can sometimes be simplified (and sped up) by means of suitable assertions (certainly, there are expressions which are very simple in PCRE that are masochism to attempt in POSIX ereg expressions).
strpos is faster than preg_match for matching literal strings (substr can be used to match literal strings anchored at either end).
Consider using strspn instead of preg_match('/[chars]+/',...)
strtr is faster than str_replace for changing single characters
?>
blahblah
blahblahblah
<?php
is faster than
echo "
blahblah
blahblahblah
";
(and I've never timed heredocs)
Like I say, experiment: you'll probably find that when it comes to things like echo() style, the compiler makes the differences negligible and not worth worrying about (they don't really slow the rendering down).
General program design practices: precomputing variables that are constant inside loops; testing common and easily-checked cases before rarer or complex ones; having a good handle on the data's structure to begin with. (E.g., just because you get the data from a database row-by-row doesn't mean you have to store it all in a flat array - not when, say, the data forms a tree. Figure out the best format for the data first and then write the code to fit.)
Sensible database structure and intelligent query design is frequently a big win. Make good indexes. Use the database to do database things, like using COUNT() if you want count rows instead of "SELECT stuff" and _num_rows(). When SELECTing, only ask for the fields you actually want instead of mindlessly using "SELECT ".