Jump to content

Is there a difference between using ' and " for strings?


aleX_hill

Recommended Posts

I have always used " for strings:

$string = "hello";

 

but I have seen a few scripts which use ' :

$string = 'hello';

 

Is there a difference? From memory when I was learning C the "hello" referred to a string, whereas 'hello' was referring to a character (and should therefore only be used if you were doing 'c' etc).

 

 

 

 

Link to comment
Share on other sites

Its probably a good idea to get to know how to use the manual well. it got quite a few neat tricks int he way its set out.

 

For instance, a string is a data type in php, so, to get to the man page I just linked you too I simply went to... http://php.net/types. The same can easily be achieved with functions, if you know the function name type http://php.net/nameoffunction and boom, straight there.

Link to comment
Share on other sites

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.