Re: speed comparison
| From: | Marek Kilimajer | Date: | Tue, 19 Nov 2002 10:36:20 +0000 |
| Subject: | Re: speed comparison | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125052@lists.php.net to get a copy of this message | ||
I like to see html highlighting, so I prefer first method, but for some small snippets I also use echo
Ernest E Vogelsinger wrote:
As Maxim pointed out a couple of days ago, this is just a matter of nanosecs, it shouldn't be really noticeable from performance. The fastest was to display non-PHP output is to escape from PHP and enter plain HTML, like $a = 'World'; ?> <H1>Hello <?=$a?>!</h1> <?php This is quite ugly to read and write, and it prohibits to separate content from output. So the next fast way to output would be echo '<H1>Hello World!</h1>'; Note the single quotes - they are (_very_slightly_) faster than double quotes. If you need to display variables you must revert to echo "<H1>Hello $a!</H1>"; to parse the string (note the double quotes here). I would always prefer to have to buy a faster server and use the second or third method than having to escape from PHP for any output, for what it's worth.