I would like to see string wrap in single quotes (') instead of double quotes (").
The reason for this is that strings wrapped in single quotes are executed faster which will have an influence especially large applications.
PHP checks strings wrapped in double quotes for variables in these strings and substitutes them, this is not the case with single quotes.
If think this is a good idea I could also create a patch for that.
cheers
Ingo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I would like to see string wrap in single quotes (') instead of double quotes (").
The reason for this is that strings wrapped in single quotes are executed faster which will have an influence especially large applications.
PHP checks strings wrapped in double quotes for variables in these strings and substitutes them, this is not the case with single quotes.
If think this is a good idea I could also create a patch for that.
cheers
Ingo
Please. Could you show us a time results for scripts using "" and '' for a "large applications". How faster will it be?
Try this on a command line, don't try to call it in a browser - takes too long:
php quotes_benchmark.php > test.out
on my laptop I get the following values:
The single quotes test took 22.293618917465 sec
The double quotes test took 24.117815971375 sec
<?php
$count = 1000000;
$n = chr(10);
echo 'testing output of single quote wrapped strings... ('.$count.' times)'.$n;
$time_start = microtime(true);
for($i = 0; $i < $count; $i++) {
echo 'string '.$i.$n;
}
$time_end = microtime(true);
$time_single = $time_end - $time_start;
echo $n.$n.'------------------------------------------------------------'.$n.$n;
echo 'testing output of double quote wrapped strings... ('.$count.' times)'.$n;
$time_start = microtime(true);
for($i = 0; $i < $count; $i++) {
echo "string $i$n";
}
$time_end = microtime(true);
$time_double = $time_end - $time_start;
echo $n.$n.'------------------------------------------------------------'.$n.$n;
echo 'The single quotes test took '.$time_single.' sec'.$n;
echo 'The double quotes test took '.$time_double.' sec'.$n;
?>