Checking for Non-Empty Strings in PHP


Check if a string is not empty and not just whitespace.

Source Code

$str = " Hello ";
if (trim($str) !== '') {
    echo "The string is not empty.";
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments