faqts : Computers : Programming : Languages : PHP : Common Problems : Strings

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 6 people (67%) answered Yes
Recently 3 of 5 people (60%) answered Yes

Entry

How do I concatenate string1 with a trailing space and string2 with a leading space into String3 so that the 2 spaces in between are maintained.

Jun 13th, 2000 16:02
Alok Sinha, Lenny Ilkovich, unknown unknown,


Perhaps, I am missing something. The answer to this seems  simple 
string manipulation.

<?
$str1="abcd ";
$str2=" efgh";
$str3=$str1.$str2;
echo '<pre>'.$str3.'</pre>';
?>    

The above shud give you string 3 with spaces in between.