Re: Variable as an index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Anthony Gentile wrote:
for e.g.
$var = 'world';
echo "hello $var";
vs
echo 'hello '.$var;

The first uses twice as many opcodes as compared to the second. The first is
init a string and adding to it the first part(string) and then the second
part (var); once completed it can echo it out. The second is simply two
opcodes, a concatenate and an echo. Interpolation.

I'd call this a micro-optimization. If changing this causes that much of a difference in your script, wow - you're way ahead of the rest of us.

http://blog.libssh2.org/index.php?/archives/28-How-long-is-a-piece-of-string.html

http://www.phpbench.com/

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux