php_beginner_83 Posted January 1, 2010 Share Posted January 1, 2010 Hi All I always have problems knowing how many quote marks to put in, can someone help me out with this... echo '"<a href="#" onclick="changeBGColor('background')">shanna</a>"'; I know its wrong the way it is. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/186877-help-with-quote-marks/ Share on other sites More sharing options...
Daniel0 Posted January 1, 2010 Share Posted January 1, 2010 What do you mean with how many? You delimit a string with either single or double quotes. You pick the one you want. If you want to use that one within the string you'll have to escape it with a backslash. In PHP, double quoted strings have variable interpolation and escape sequences (e.g. \n for newline). Single quoted strings are literal. Quote Link to comment https://forums.phpfreaks.com/topic/186877-help-with-quote-marks/#findComment-986881 Share on other sites More sharing options...
php_beginner_83 Posted January 1, 2010 Author Share Posted January 1, 2010 I mean to get it to work. I can get it to work in html but I need this line of code in php and I have always been a little of unused when to use quote marks like do I need them around changeBGColor??? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/186877-help-with-quote-marks/#findComment-986882 Share on other sites More sharing options...
php_beginner_83 Posted January 1, 2010 Author Share Posted January 1, 2010 no worries you're explanation helped. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/186877-help-with-quote-marks/#findComment-986885 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.