note 72374 added to function.is-object
| From: | szrryaatyahoodotcom at osu1 dot php dot net | Date: | Tue, 16 Jan 2007 19:05:04 +0000 |
| Subject: | note 72374 added to function.is-object | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-121804@lists.php.net to get a copy of this message | ||
I just thought I'd point out that the function is_obj() below is rather unnecessary...
get_class() returns FALSE if you pass a non-object, so that takes care of the whole is_object() if
in the code.
Instead, something simple like:
<?php
if (get_class($object) == 'cheese') {
// ...
}
?>
Would suffice... you can add your own strtolower() around that if you want, but no need to make a
wrapper for that. (Unless you just really want to, in which case the code below works fine.)
----
Server IP: 64.71.164.2
Probable Submitter: 64.253.100.16
----
Manual Page -- http://www.php.net/manual/en/function.is-object.php
Edit -- https://master.php.net/note/edit/72374
Del: integrated -- https://master.php.net/note/delete/72374/integrated
Del: useless -- https://master.php.net/note/delete/72374/useless
Del: bad code -- https://master.php.net/note/delete/72374/bad+code
Del: spam -- https://master.php.net/note/delete/72374/spam
Del: non-english -- https://master.php.net/note/delete/72374/non-english
Del: in docs -- https://master.php.net/note/delete/72374/in+docs
Del: other reasons-- https://master.php.net/note/delete/72374
Reject -- https://master.php.net/note/reject/72374
Search -- https://master.php.net/manage/user-notes.php