note 129696 added to function.class-exists
| From: | paul.allsopp@digital-pig.com | Date: | Fri, 09 Aug 2024 05:44:42 +0000 |
| Subject: | note 129696 added to function.class-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221468@lists.php.net to get a copy of this message | ||
Example #2 is just silly! Ignore it at all costs!
In example #2 a file is included from a string, passed into the function. Yet the class_exists check
is made on an object, making the entire function worthless. Also, you cannot do this:
class_exists($some_string::class);
So, don't use example #2, modified.
Check if the file exists. If it does, require it. Then check for the class!
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 2600:8800:881f:f300:9865:b904:49f7:6a4)
----
Manual Page -- https://php.net/manual/en/function.class-exists.php
Edit -- https://main.php.net/note/edit/129696
Del: integrated -- https://main.php.net/note/delete/129696/integrated
Del: useless -- https://main.php.net/note/delete/129696/useless
Del: bad code -- https://main.php.net/note/delete/129696/bad+code
Del: spam -- https://main.php.net/note/delete/129696/spam
Del: non-english -- https://main.php.net/note/delete/129696/non-english
Del: in docs -- https://main.php.net/note/delete/129696/in+docs
Del: other reasons-- https://main.php.net/note/delete/129696
Reject -- https://main.php.net/note/reject/129696
Search -- https://main.php.net/manage/user-notes.php