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).

 

 

 

 

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.

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.