Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Which is faster?
07-14-2008, 07:29 AM #1
Which is faster?
<?php $var = "hi"; echo $var; ?>
<?php $var = "hi"; ?> <?php echo $var; ?>
$var = "hi"; ?><?=$var ?>
To add to it, how come if there are no syntaxes following the last function, it can ignore a ;?
07-14-2008, 08:34 AM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,662 Times in 2,631 Posts
I haven't tested any of the above, but I would suspect the first would be the fastest. Think of a light switch, it takes more energy to turn the light on than off than on again, than it does to leave it on for 10 minutes. The last two are like telling the processor you're all done, than changing you're mind and starting again. I mean, I haven't tested anything, but I would assume that the last two would be slower.
As for the <?=, I'm trying to find reference for it. I don't use any short tag style, but my understanding is <?= is an evaluative syntax, so you are only allowed one value to start with - meaning no semi-colon required. As soon as I finish this FFT battle, I'll see if I can't find the reference for it on the php site.
Last edited by Fou-Lu; 07-14-2008 at 08:58 AM.
Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)PHP Code:
header('HTTP/1.1 420 Enhance Your Calm');