[email protected] Posted October 23, 2009 Share Posted October 23, 2009 I have string one $string1 and another $string2. How to concatenate (add) both of them $string1+" "+$string2 also check condition for the total string length not more than 100 characters Link to comment https://forums.phpfreaks.com/topic/178774-solved-concatenate-two-strings/ Share on other sites More sharing options...
taquitosensei Posted October 23, 2009 Share Posted October 23, 2009 $newstring=$string." ".$string2; $newstringlength=strlen($newstring); if($newstringlenth > 100) { // do whatever } Link to comment https://forums.phpfreaks.com/topic/178774-solved-concatenate-two-strings/#findComment-943039 Share on other sites More sharing options...
severndigital Posted October 23, 2009 Share Posted October 23, 2009 //add them together: $newstring = $string1 . $string2; //no space between $newstring = $string1 . " " . $string2; //with space between to check the string length you would use strlen(); http://us.php.net/manual/en/function.strlen.php Link to comment https://forums.phpfreaks.com/topic/178774-solved-concatenate-two-strings/#findComment-943041 Share on other sites More sharing options...
[email protected] Posted October 23, 2009 Author Share Posted October 23, 2009 Thanks guys... Link to comment https://forums.phpfreaks.com/topic/178774-solved-concatenate-two-strings/#findComment-943047 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.