Hello all,

I have a small PHP script that creates an XML doc on-the-fly for an AJAX application. Right now the page that we've got is just using a meta refresh to fetch the new data from the server, but that's so 1999! I'm incorporating AJAX to fetch the new page data now so I've got a quick question. Is it faster to just use echo() to echo out the whole page with my variables like this:

<?php

echo "<?xml version=\"1.0\"?>\n";
echo "<root>\n";
echo "\t<element_1>$element_1</element_1>\n";
echo "\t<element_2>$element_2</element_2>\n";
etc. etc...?

Or is it faster to just output the XML directly and insert the data in code blocks like so:

?>
<element_1><?=$element_1 ?></element_1>
<element_2><?=$element_2 ?></element_2>
etc. etc...?

I'm just wondering which is faster. Our site is already seeing a lot more traffic than we anticipated so I'd like to optimize the PHP as much as possible. Even if one only saves a few milliseconds over the other, it's a big savings over a long day of hundreds of thousands of page hits.

Thanks,
-Nick



[Non-text portions of this message have been removed]



Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list




SPONSORED LINKS
Php mysql Job postings


YAHOO! GROUPS LINKS




Reply via email to