Assuming your string is in $string :
if(strlen(trim($string)) > 0){
Note that this will not allow any lines consisting of just spaces, no matter how many there are.
If you are checking for data entry, you might think of other degenerative cases, such as someone entering only an underscore or other inappropriate input. If you tell us more about the situation you are trying to deal with, we could provide a more reliable verification.
source share