PHP中的get_declared_classes()函数

get_declared_classes返回带有已定义类名称的数组。

语法

get_declared_classes (void)

参数

  • 无效-不需要参数。

返回

get_declared_classes()函数返回当前脚本中已声明类的名称的数组。

示例

以下是一个例子-

<?php
print_r(get_declared_classes());
?>

输出结果

以下是输出-

Array
(
   [0] => stdClass
   [1] => Exception
   [2] => ErrorException
   [3] => Error
   [4] => ParseError
   [5] => TypeError
   [6] => ArgumentCountError
   [7] => ArithmeticError
   [8] => DivisionByZeroError
   [9] => Closure
   [10] => Generator
   [11] => ClosedGeneratorException
   [12] => DateTime
   [13] => DateTimeImmutable
   [14] => DateTimeZone
   [15] => DateInterval
   [16] => DatePeriod
   [17] => LibXMLError
   [18] => ReflectionException
   [19] => Reflection
   [20] => ReflectionFunctionAbstract
   [21] => ReflectionFunction
   [22] => ReflectionGenerator
   [23] => ReflectionParameter
   [24] => ReflectionType
   [25] => ReflectionNamedType
   [26] => ReflectionMethod
   [27] => ReflectionClass
   [28] => ReflectionObject
   [29] => ReflectionProperty
   [30] => ReflectionClassConstant
   [31] => ReflectionExtension
   [32] => ReflectionZendExtension
   [33] => LogicException
   [34] => BadFunctionCallException
   [35] => BadMethodCallException
   [36] => DomainException
   [37] => InvalidArgumentException
   [38] => LengthException
   [39] => OutOfRangeException
   [40] => RuntimeException
   [41] => OutOfBoundsException
   [42] => OverflowException
   [43] => RangeException
   [44] => UnderflowException
   [45] => UnexpectedValueException
   [46] => RecursiveIteratorIterator
   [47] => IteratorIterator
   [48] => FilterIterator
   [49] => RecursiveFilterIterator
   [50] => CallbackFilterIterator
   [51] => RecursiveCallbackFilterIterator
   [52] => ParentIterator
   [53] => LimitIterator
   [54] => CachingIterator
   [55] => RecursiveCachingIterator
   [56] => NoRewindIterator
   [57] => AppendIterator
   [58] => InfiniteIterator
   [59] => RegexIterator
   [60] => RecursiveRegexIterator
   [61] => EmptyIterator
   [62] => RecursiveTreeIterator
   [63] => ArrayObject
   [64] => ArrayIterator
   [65] => RecursiveArrayIterator
   [66] => SplFileInfo
   [67] => DirectoryIterator
   [68] => FilesystemIterator
   [69] => RecursiveDirectoryIterator
   [70] => GlobIterator
   [71] => SplFileObject
   [72] => SplTempFileObject
   [73] => SplDoublyLinkedList
   [74] => SplQueue
   [75] => SplStack
   [76] => SplHeap
   [77] => SplMinHeap
   [78] => SplMaxHeap
   [79] => SplPriorityQueue
   [80] => SplFixedArray
   [81] => SplObjectStorage
   [82] => MultipleIterator
   [83] => SessionHandler
   [84] => __PHP_Incomplete_Class
   [85] => php_user_filter
   [86] => Directory
   [87] => AssertionError
   [88] => CURLFile
   [89] => finfo
   [90] => PDOException
   [91] => PDO
   [92] => PDOStatement
   [93] => PDORow
   [94] => PharException
   [95] => Phar
   [96] => PharData
   [97] => PharFileInfo
   [98] => SQLite3
   [99] => SQLite3Stmt
   [100] => SQLite3Result
   [101] => mysqli_sql_exception
   [102] => mysqli_driver
   [103] => mysqli
   [104] => mysqli_warning
   [105] => mysqli_result
   [106] => mysqli_stmt
)