//beak into 140 character chunks
$strParts = str_split( $str, 140 );
//if the first character of the second chunk is not whitespace
if( isset( $strParts[1] ) && !preg_match( '/^\s/', $strParts[1] ) {
//strip off the last partial word from the first chunk
$strParts[0] = preg_replace( '/\s\w+$/', '', $strParts[0] );
}
//you're done
$str = $strParts[0];