w3resource

php.js : isset() function

isset() function

The isset () function is used to find whether a variable is set or not. The isset() function return false if testing variable contains null value.

Version:

1103.1210

Syntax:

isset(variable1, variable2......) 

Parameters:

Name Description Required /
Optional
Type
variable1 The variable being checked Required Mixed*
Variable2 ...... More variable to be checked. Optional Mixed*

*Mixed : Mixed indicates that a parameter may accept multiple (but not necessarily all) types.

Example of php.js isset() function:

In the following web document isset() function test whether a variable is set or not.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>php.js : isset() function example</title>
<script type="text/javascript" src="../../phpjs/variable/variable.min.js"> </script>
</head>
<body>
<h1 style="color: green">php.js : isset() function example</h1>
<h3>Check whether a variable is set or not...</h3>
<hr />
<script type="text/javascript">
//This is done to make the following JavaScript code compatible to XHTML. <![CDATA[
var1 = 'test';
var_dump(isset(var1)); 
//]]>
</script>
</body>
</html>

Output of the function:

bool(true)

View example of php.js isset() function in browser

Download phpjs.zip

Previous: php.js : is_string() function
Next: php.js : print_r() function



Follow us on Facebook and Twitter for latest update.