This function will return an array of classes that have been declared either by PHP, installed extensions, or the user.

It only contains classes declared by the time the function is called. This means if you autoload classes for example, they may not appear in the results as you expect.

$c = new $class_name;
// here, if using autoload, we may not have the class declared

You may also want to consult the list of predefined classes in the manual. That list does not include those of extensions, only the standard predefined classes PHP brings with it.

// your results will likely vary
$list = get_declared_classes();
/*
array (
  0 => 'stdClass',
  1 => 'Exception',
  2 => 'ErrorException',
  3 => 'COMPersistHelper',
  4 => 'com_exception',
  5 => 'com_safearray_proxy',
  6 => 'variant',
  7 => 'com',
  8 => 'dotnet',
  9 => 'ReflectionException',
  10 => 'Reflection',
  11 => 'ReflectionFunctionAbstract',
  12 => 'ReflectionFunction',
  13 => 'ReflectionParameter',
  14 => 'ReflectionMethod',
  15 => 'ReflectionClass',
  16 => 'ReflectionObject',
  17 => 'ReflectionProperty',
  18 => 'ReflectionExtension',
  19 => 'DateTime',
  20 => 'DateTimeZone',
  21 => 'LibXMLError',
  22 => '__PHP_Incomplete_Class',
  23 => 'php_user_filter',
  24 => 'Directory',
  25 => 'SimpleXMLElement',
  26 => 'DOMException',
  27 => 'DOMStringList',
  28 => 'DOMNameList',
  29 => 'DOMImplementationList',
  30 => 'DOMImplementationSource',
  31 => 'DOMImplementation',
  32 => 'DOMNode',
  33 => 'DOMNameSpaceNode',
  34 => 'DOMDocumentFragment',
  35 => 'DOMDocument',
  36 => 'DOMNodeList',
  37 => 'DOMNamedNodeMap',
  38 => 'DOMCharacterData',
  39 => 'DOMAttr',
  40 => 'DOMElement',
  41 => 'DOMText',
  42 => 'DOMComment',
  43 => 'DOMTypeinfo',
  44 => 'DOMUserDataHandler',
  45 => 'DOMDomError',
  46 => 'DOMErrorHandler',
  47 => 'DOMLocator',
  48 => 'DOMConfiguration',
  49 => 'DOMCdataSection',
  50 => 'DOMDocumentType',
  51 => 'DOMNotation',
  52 => 'DOMEntity',
  53 => 'DOMEntityReference',
  54 => 'DOMProcessingInstruction',
  55 => 'DOMStringExtend',
  56 => 'DOMXPath',
  57 => 'RecursiveIteratorIterator',
  58 => 'IteratorIterator',
  59 => 'FilterIterator',
  60 => 'RecursiveFilterIterator',
  61 => 'ParentIterator',
  62 => 'LimitIterator',
  63 => 'CachingIterator',
  64 => 'RecursiveCachingIterator',
  65 => 'NoRewindIterator',
  66 => 'AppendIterator',
  67 => 'InfiniteIterator',
  68 => 'RegexIterator',
  69 => 'RecursiveRegexIterator',
  70 => 'EmptyIterator',
  71 => 'ArrayObject',
  72 => 'ArrayIterator',
  73 => 'RecursiveArrayIterator',
  74 => 'SplFileInfo',
  75 => 'DirectoryIterator',
  76 => 'RecursiveDirectoryIterator',
  77 => 'SplFileObject',
  78 => 'SplTempFileObject',
  79 => 'SimpleXMLIterator',
  80 => 'LogicException',
  81 => 'BadFunctionCallException',
  82 => 'BadMethodCallException',
  83 => 'DomainException',
  84 => 'InvalidArgumentException',
  85 => 'LengthException',
  86 => 'OutOfRangeException',
  87 => 'RuntimeException',
  88 => 'OutOfBoundsException',
  89 => 'OverflowException',
  90 => 'RangeException',
  91 => 'UnderflowException',
  92 => 'UnexpectedValueException',
  93 => 'SplObjectStorage',
  94 => 'XMLReader',
  95 => 'XMLWriter',
  96 => 'ImagickException',
  97 => 'ImagickDrawException',
  98 => 'ImagickPixelIteratorException',
  99 => 'ImagickPixelException',
  100 => 'Imagick',
  101 => 'ImagickDraw',
  102 => 'ImagickPixelIterator',
  103 => 'ImagickPixel'
)
*/