Jump to content

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
*/
?>

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.