Jump to content

single over double qoutes really worth it?


Liquid Fire

Recommended Posts

Is the performance of the single quote(') really better than the double quote(")?

 

I come from a C++ background and i alway used double quotes in there(not sure way) so for one it is more natural. I also think the code looks alot cleaner, for example:

 

print("This is just some {$var1} random text {$var2} to show an example {$var3} of what i mean");

 

than

 

print('This is just some' . $var1 . 'random text' . $var2 . 'to show an example' . $var3 . 'of what i mean');

 

This is just a quick example but some stuff i have seen it is just hard to see where the string stops and the variable start.  I think if you script is running slow and you change all the " to ' that it will not make a big difference because soemthing else must be wrong.

 

What do you think?

Just another way to do quotes (its what ever you like as a programmer)  PHP is very flexible and has very lose grammar like American English.

 

<?php
$var1 = "yes";
$var2 = 23;
echo "The value of \"Var1\": ".$var1." <br/> The value of \"Var2\": ".$var2;
/*output
The value of "Var1": yes
The value of "Var2": 23
*/
?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.