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 ? Link to comment https://forums.phpfreaks.com/topic/117734-solved-help-with-string/ 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\""; Link to comment https://forums.phpfreaks.com/topic/117734-solved-help-with-string/#findComment-605553 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"; ?> Link to comment https://forums.phpfreaks.com/topic/117734-solved-help-with-string/#findComment-605555 Share on other sites More sharing options...
SirChick Posted August 1, 2008 Author Share Posted August 1, 2008 Thank you guys Link to comment https://forums.phpfreaks.com/topic/117734-solved-help-with-string/#findComment-605562 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.