Jump to content

concatenation with space


niche
 Share

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.

Edited by chibineku
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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...