I have a few variables set, example:
$url = 'http://stackoverflow.com'; $tag1 = '#lorem1'; $tag2 = '#lorem2'; $tag3 = '#lorem3'; $tag4 = '#lorem4'; $tag5 = '#lorem5'; I want to put them all together into a string. Something like this:
$final = $url .' '. $tag1 .' '. $tag2... However, if the $final string will exceed 140 characters, then do not add variable.
So for example, if $final string is 137 characters, then do not add $tag5 into joined variable string because its value will make it exceed 140 characters.
How can I do this?