codice:
if ( preg_match('/^\s*$/', $string ) ) {
    // stringa vuota
}