Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Variable parsing in strings
07-14-2008, 10:01 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,662 Times in 2,631 Posts
Using double quotations is always slower than using single quotations. This is because the PHP interpreter considers that double quotations can contain parsable data while single quotations can be only string data.
My understanding of printf is that it is slower than sprintf. Printf is likely chained to the sprintf command and include both sprintf and print for you. I'd have to run test to be certain, but I'd suspect that:PHP Code:
echo "$var is awesome";
// Is slower than
echo $var . ' is awesome';
I'd have to do test to be certain, but I would suspect this is the case.PHP Code:
$out = sprintf("%s", "Hello World");
// Is approx the same time as
printf("%s", "Hello World");
Last edited by Fou-Lu; 07-14-2008 at 10:08 PM.
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');