aleX_hill Posted March 12, 2010 Share Posted March 12, 2010 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). Quote Link to comment https://forums.phpfreaks.com/topic/194973-is-there-a-difference-between-using-and-for-strings/ Share on other sites More sharing options...
trq Posted March 12, 2010 Share Posted March 12, 2010 Yes, there is a difference. Its all covered in the manual. http://php.net/manual/en/language.types.string.php Quote Link to comment https://forums.phpfreaks.com/topic/194973-is-there-a-difference-between-using-and-for-strings/#findComment-1025041 Share on other sites More sharing options...
aleX_hill Posted March 12, 2010 Author Share Posted March 12, 2010 Thanks. my google searching just kept bringing me to the page with all the string functions. Quote Link to comment https://forums.phpfreaks.com/topic/194973-is-there-a-difference-between-using-and-for-strings/#findComment-1025053 Share on other sites More sharing options...
trq Posted March 12, 2010 Share Posted March 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/194973-is-there-a-difference-between-using-and-for-strings/#findComment-1025070 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.