SirChick Posted August 1, 2008 Share Posted August 1, 2008 I have a variable which contains "," and " symbols so i do not know how to stop it breaking... this is an example of what i have: $Var = "First name","belong's to" Echo $Var; I currently get this error: Parse error: syntax error, unexpected ',' in C:\xampp\htdocs\tes2222t.php on line 2 Which was expected The echo should show: "First name","belong's to" How ever single quotes around it wont work because of the "belong's to" and the double quotes wont due to the double quotes in the string... What else can i use to assign it to the var so the symbols don't break it ? Quote Link to comment Share on other sites More sharing options...
MaaSTaaR Posted August 1, 2008 Share Posted August 1, 2008 Hello ... try : echo "\"First name\",\"belong's to\""; Quote Link to comment Share on other sites More sharing options...
coder_ Posted August 1, 2008 Share Posted August 1, 2008 to put two string togather you use "." So something like this: <?php $var = "String 1 " . "String 2"; ?> Quote Link to comment Share on other sites More sharing options...
SirChick Posted August 1, 2008 Author Share Posted August 1, 2008 Thank you guys Quote Link to comment 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.