[wp-hackers] usage of single quotes and double quotes in PHP
eric at eam.me
Thu Mar 3 22:06:17 UTC 2011
According to the PHP manual:
Parsing variables within strings uses more memory than string concatenation.
> When writing a PHP script in which memory usage is a concern, consider using
> the concatenation operator (.) rather than variable parsing.
So ... echo "This is a $var"; would be more demanding on the server than
echo 'This is a ' . $var;
On Thu, Mar 3, 2011 at 1:43 PM, Satish Gandham <satish.iitg at gmail.com>wrote:
> *We use single quotes when we are not evaluating anything within the*
> **echo "Hello World!" uses more cpu resources than echo 'Hello World'.
> I* want know which of these two is better.
> * <?php
> ** echo "This is a string with variable $test_variable"
> ** ?>
> ** <?php
> ** echo 'This is another variant of the above statement '.$test_variable
> ** ?>
> Satish Gandham
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers