niche Posted May 6, 2010 Share Posted May 6, 2010 Is there a more efficient way to concatenation with a space than: some text . " " . some text?Thanks Link to comment Share on other sites More sharing options...
chibineku Posted May 6, 2010 Share Posted May 6, 2010 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 More sharing options...
niche Posted May 6, 2010 Author Share Posted May 6, 2010 Please give and example of your suggestion.Thanks Link to comment Share on other sites More sharing options...
chibineku Posted May 6, 2010 Share Posted May 6, 2010 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 More sharing options...
niche Posted May 7, 2010 Author Share Posted May 7, 2010 Wow, I didn't know you could do that.Thanks to chibineku! Link to comment Share on other sites More sharing options...
chibineku Posted May 7, 2010 Share Posted May 7, 2010 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 More sharing options...
jeffman Posted May 7, 2010 Share Posted May 7, 2010 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.