Fastest way:
1. don't use array lookups, they're slower than using local variables in a
function.
2. Create a string with the all the text you're going to print, then print
that string.
3. Hash/Array indexes should ALWAYS be enclosed in quotes unless they're
numerical indexes or constants. Why? because the current behaviour may go
away in the future..
4. There's conflicting evidence that using ' is faster than " but that's not
always true. It is faster to print "<td>".$var."</td>" than "<td>$var</td>"
but the first method could be as fast as '<td>'.$var.'</td>' (see
php.weblogs.com for a benchmark site posted some months ago)
Donncha.
On Friday 20 December 2002 13:45, Ken Guest wrote:
> Donncha O Caoimh wrote:
> >Actually, including files in PHP is relatively inexpensive and tests have
> >shown that including lots of files doesn't particularly slow down an
> >application, so I think it would help scale an application.
>> On something related, which way does the best performance lie? Is the
> following quickest, or is it best to
> minimize the amount of times php code is (seperately) defined?
>> <TD><?php print $my_res[date]?></TD>
> <TD><?php print $my_res[client]?> </TD>
> <TD><?php print $my_res[ponum]?></TD>
> <TD><?php print $my_res[ship]?>kwg</TD>
>>> k., thinking he really should know better about this
>
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!