Introduction
In this article I will discuss the "get_declare_classes()" and "get_class_method()" functions in PHP. These functions are for classes and objects in PHP.
First of all I am using the get_declare_classes() function. This function returns an array of class names of classes defined in the current program.
Syntax
get_declare_classes(void);
|
Parameter |
void |
void means no parameter required |
Example
- <?php
- echo "<pre>";
- print_r(get_declared_classes());
- ?>
Returns an array of the class names of the defined classes in this code.
Output
This function either returns an array of the method names of the specified class names or returns the errors.
Syntax
get_class_method($class_name);
|
Parameter |
class name |
Required the class name |
Example
- <?php
- class vinod
- {
- function vinod()
- {
- return(true);
- }
- function myfuncA()
- {
- return(true);
- }
- function myfuncB()
- {
- return(true);
- }
- }
- $class_methods = get_class_methods('vinod');
- $class_methods = get_class_methods(new vinod());
-
- foreach ($class_methods as $method_name)
- {
- echo "$method_name<br>";
- }
-
- ?>
Returns an array of the method names specified by the class.