note 81323 modified in function.gettype by danbrown
| From: | danbrown@php.net | Date: | Sun, 08 Nov 2009 16:20:38 +0000 |
| Subject: | note 81323 modified in function.gettype by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162645@lists.php.net to get a copy of this message | ||
In some rare cases a class instance object returns false when an object but gettype() returns
"object".
<?php
$x = new classvar();
$save = serialize($x);
// ......
$obj = unserialize($save);
// here sometimes is_object() returns FALSE
if (is_object($x) || gettype($x) === "object")
{
// ... do something
}
?>
--was--
In some rare cases a class instance object returns false when an object but gettype() returns
"object".
$x = new classvar();
$save = serialize($x);
......
$obj = unserialize($save);
// here sometimes is_object() returns FALSE
if (is_object($x) || gettype($x) === "object")
{
... do something
}
http://php.net/manual/en/function.gettype.php