salman_ahad@yahoo.com 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 Quote 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 } Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/178774-solved-concatenate-two-strings/#findComment-943041 Share on other sites More sharing options...
salman_ahad@yahoo.com Posted October 23, 2009 Author Share Posted October 23, 2009 Thanks guys... Quote Link to comment https://forums.phpfreaks.com/topic/178774-solved-concatenate-two-strings/#findComment-943047 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.