Jump to content

concatenation with space


niche

Recommended Posts

Is there a more efficient way to concatenation with a space than: some text . " " . some text?Thanks

Link to comment
Share on other sites

I don't think so, no. You could define a variable to make it easier:$s = ." ".;So it's fewer characters to type?Well, of course, you can do: "$data $more_data" and skip a couple of characters.

Link to comment
Share on other sites

Please give and example of your suggestion.Thanks

Link to comment
Share on other sites

I already gave an example of the second suggestion, which was to simply surround your entire expression, variables and all, in double quotes.Forget the first suggestion, it doesn't help - you still need to concatenate the variables, so it saves you almost no effort.

Link to comment
Share on other sites

Wow, I didn't know you could do that.Thanks to chibineku!

Link to comment
Share on other sites

Note that if you use single quotes, the strings will be represented literally - i.e. with dollar signs and no substitution of the variable for its value.

Link to comment
Share on other sites

I don't mean to sound picky or sarcastic, but the technique chibineku describes is really PHP 101. Maybe you should get hold of a basic PHP reference? Programming PHP by Rasmus Lerdorf et al. is a good place to start. (Lerdorf invented PHP.) There may be other fundamentals you've missed that will make your life easier.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...