Re: Echo vs in/out
| From: | Yasuo Ohgaki | Date: | Mon, 29 Oct 2001 04:56:38 +0000 |
| Subject: | Re: Echo vs in/out | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-69242@lists.php.net to get a copy of this message | ||
Andre næss wrote:
I'm currently in the middle of a discussion with some fellow PHP developers regarding the speed of what we call in/out compared to echo. With in/out we mean stuff like this: // php code ?> <html>some html</html> <?php // more php The manual states that PHP treats ?><?php as an echo statement, and I don't think there can be any speed difference between the two, however one of my fellow developers thinks there is a difference, and created a test which showed a 60% speed difference (using a for loop that ran 10000 times). The test was badly executed IMO, so I ran my own which showed virtually no difference, but rather than getting into a flame-war I thought I'd just ask here for a quick answer. Is there a difference, and if so, is it significant?Just try following 2 scripts === script1 === <?php for($i=0; $i < 50000; $i++) { echo 'abcderfghjklmn '; } ?> === end === === script2 === <?php for($i=0; $i < 50000; $i++) { ?> abcderfghjklmn <?php } ?> === end === There is not much difference, but script1 is just a little faster on my system. -- Yasuo Ohgaki