function IsNullOrEmptyString(string|null $str){
return $str === null || trim($str) === '';
}
$str = "";
echo IsNullOrEmptyString($str) ? "yes" : "no";
echo "\n";
$str = null;
echo IsNullOrEmptyString($str) ? "yes" : "no";
echo "\n";
$str = "php";
echo IsNullOrEmptyString($str) ? "yes" : "no";
/*
run:
yes
yes
no
*/