|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-04-19 12:02 UTC] thekid at thekid dot de
[2003-04-19 16:14 UTC] helly@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 04:00:01 2025 UTC |
Given an instance of a nested class, get_class() returns the ":: separated" name for it, as expected. However, passing that value right back to class_exists() always fails -- i.e., returns FALSE. <?php class Foo { class Bar { } } $x = new Foo::Bar; if (class_exists(get_class($x))) { echo "x is looking good\n"; } else { echo "x is apparently not itself\n"; } ?> In addition, get_declared_classes() will only report on the top-level classes, leaving out any that are nested. In this example, it would report "Foo", but not "Foo::Bar".