what difference between NULL, blank and empty in php?

Posted by I Like PHP on Stack Overflow See other posts from Stack Overflow or by I Like PHP
Published on 2010-03-17T09:54:44Z Indexed on 2010/03/17 10:01 UTC
Read the original article Hit count: 154

Filed under:

i have one form which have some input box and some select box. i want to apply that nothing can be empty or blank before further activity, so i use below condition

foreach($_POST as $k=>$v)
{
    if($v=='' || $v==NULL || empty($v))
    {
        $_SESSION['errMsg']=' Please fill all the fields properly';
                    header("location:somepage.php");
                    exit;
    }
     }

now my question is:

above if is useful or not?

if not then which condition is enough to prevent blank entry $v=='' or $v==NULL or empty($v) or i have to use all of these conditions?

Thanks in advance

© Stack Overflow or respective owner

Related posts about php