isset Function in PHP – Check for any Variable if it is Set or Not in PHP

by Hiroshi on June 23, 2008

in isset, PHP Functions

isset — Determine whether a variable is set or not! Returns TRUE if var exists; FALSE otherwise. If a variable has been unset with unset(), it will no longer be set. isset() will return FALSE if testing a variable that has been set to NULL. isset() only works with variables as passing anything else will result in a parse error. For checking if constants are set use the defined() function.


    $_SESSION['views'] = $_SESSION['views']+ 1;
    $_SESSION['views'] = 1;
echo "views = ". $_SESSION['views'];

The above script is checking that ‘views’ or $views variable is set in session or not.

Related Posts

Previous post:

Next post: