Checking Whether a Variable Is Set: isset( ) : isset « Data Type « PHP






Checking Whether a Variable Is Set: isset( )

 
<?
    $foo = 1;
    if (isset($foo)) {
            echo "Foo is set\n";
    } else {
            echo "Foo is not set\n";
    }

    if (isset($bar)) {
            echo "Bar is set\n";
    } else {
            echo "Bar is not set\n";
    }
?>
  
  








Related examples in the same category

1.Checking PHP's global authentication variables
2.Using the isset() function to see whether an array element is defined for a given index.
3.bool isset ( mixed var [, mixed var [, ...]] ) returns true if its parameter has been set
4.Viewing the username cookie