Periksa panjang string lebih besar dari 0 php

if(strlen(trim($string)) > 0){
   // $string has at least one non-space character
}
Blue-eyed Booby