php.js : is_object() function

is_object() function

The is_object() function is used to check whether a variable is an object or not. The function returns true if the variable is an object otherwise false.






Name Description Required /
var_name The variable being checked Required Mixed*

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

Example of php.js is_object() function:

In the following web document is_object() function test whether a variable type is an object or not.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>php.js : is_object() function example</title>
<script type="text/javascript" src="../../phpjs/variable/variable.min.js"> </script>
<h1 style="color: green">php.js : is_object() function example</h1>
<h3>Check whether a variable is an object or not.... </h3>
<hr />
<script type="text/javascript">
//This is done to make the following JavaScript code compatible to XHTML. <![CDATA[
function studentDetails()
document.write( "The name of the student is " + this.name + " Class : " + this.class + " Roll No.: " + this.rollno+ '<br />')
function student(name, class, rollno)
this.name = name
this.class = class
this.rollno = rollno
this.studentDetails = studentDetails
studentv = new student("John", "V", 10);
studentvi = new student("David Rayy", "VI", 12);
if (is_object(studentvi))
document.write("It is an object");

Output of the function:

The name of the student is John Class : V Roll No.: 10
The name of the student is David Rayy Class : VI Roll No.: 12
It is an object 

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

Download phpjs.zip

Previous: php.js : is_numeric() function
Next: php.js : is_real() function

Follow us on Facebook and Twitter for latest update.