PHP is_object() Function
The is_ object() function in PHP finds whether the specified variable is an object or not. It returns a Boolean value TRUE if the specified var is an object else it returns FALSE.
Syntax
is_object(mixed$var)
var(required)- This parameter represents the value to check.
Return
This returns a Boolean value TRUE if the specified var is a number or a numeric string else it returns FALSE otherwise.
Example 1
Output
bool(true) bool(true)
Example 2
subjects); } $state_name = new stdClass; $state_name->subjects = Array('Haryana', 'Punjab', 'Rajasthan'); var_dump(get_state(NULL)); var_dump(get_state($state_name)); ?>
Output:
bool(false) array(3) { [0]=> string(7) "Haryana" [1]=> string(6) "Punjab" [2]=> string(9) "Rajasthan" }