Home / PHP Tips Generated By ChatGPT / 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."; }