Use this code snippet to check if string length is greater than zero in PHP.
if( strlen( trim( $string )) > 0 ){
// do something cool if $string has at least one non-space character
}
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.