These functions are introduced in this section.
Determining Whether a Class Exists
The class_exists() function returns TRUE if the class specified by class_name exists
within the currently executing script context, and returns FALSE otherwise. Its prototype
follows:
boolean class_exists(string class_name)
Determining Object Context
The get_class() function returns the name of the class to which object belongs and
returns FALSE if object is not an object. Its prototype follows:
string get_class(object object)
190 CHAPTER 6 ?– O BJECT-ORIENTED PHP
Learning About Class Methods
The get_class_methods() function returns an array containing all method names
defined by the class class_name. Its prototype follows:
array get_class_methods(mixed class_name)
Learning About Class Fields
The get_class_vars() function returns an associative array containing the names
of all fields and their corresponding values defined within the class specified by
class_name. Its prototype follows:
array get_class_vars(string class_name)
Learning About Declared Classes
The function get_declared_classes() returns an array containing the names of all
classes defined within the currently executing script. The output of this function will
vary according to how your PHP distribution is configured. For instance, executing
get_declared_classes() on a test server produces a list of 97 classes.
Pages:
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268