jaxdevil Posted June 7, 2008 Share Posted June 7, 2008 I know this one I just can't remember it. How do I make this: $FinalCat = '$SubSubCat|$SubSubSubCat'; Display the actual variable with a | and then the other variable. I.e. if the variable $SubSubCat means 'hello' and $SubSubSubCat means 'goodbye' then I want to make $FinalCat mean 'hello|goodbye' How do I accomplish this? Thanks in advance guys! SK Link to comment https://forums.phpfreaks.com/topic/109177-solved-really-simple-how-to-display-a-variable-then-delimiter-then-variable/ Share on other sites More sharing options...
GingerRobot Posted June 7, 2008 Share Posted June 7, 2008 Couple of different approaches: echo $foo.'|'.$bar; //or: echo "$foo|$bar"; Basically, variables inside single quotes are not parsed. That is, if you echo this: echo '$var'; Then all that will be displayed is $var. However, they are parsed (and therefore their value is displayed) if inside double quotes. So you either place them inside double quotes or use no quotes at all and concatenate. Link to comment https://forums.phpfreaks.com/topic/109177-solved-really-simple-how-to-display-a-variable-then-delimiter-then-variable/#findComment-560027 Share on other sites More sharing options...
Lefteris Posted June 7, 2008 Share Posted June 7, 2008 That's easy All you gotta do is type: $FinalCat = $subsubcat."|".$subsubsubcat Edit: Damn! Was slow Link to comment https://forums.phpfreaks.com/topic/109177-solved-really-simple-how-to-display-a-variable-then-delimiter-then-variable/#findComment-560029 Share on other sites More sharing options...
jaxdevil Posted June 7, 2008 Author Share Posted June 7, 2008 Thanks guys. Thats what I was forgetting. Cheers! SK Link to comment https://forums.phpfreaks.com/topic/109177-solved-really-simple-how-to-display-a-variable-then-delimiter-then-variable/#findComment-560032 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.