Monday, November 9, 2020

PHP | Class/Object Functions

PHP Class/Object Functions


Hello dear readers! welcome back to another edition of our tutorial on PHP. In this tutorial guide, we are going to be discussing about the PHP Class/Object Functions.

PHP Class/Object functions allow you to obtain information about classes and instance objects. You can obtain the name of the class to which an object belongs, as well as it's member properties and methods.

Installation

There is no Installation needed to use these functions; they are part of PHP core.

Runtime Configuration

It has no configuration directives defined in php.ini.


List of Functions

The following below is the list of class/object functions available in PHP along with the early versions of PHP supported -

Sr.NoFunction & DescriptionPHP
1

call_user_method_array()

Call a user method given with an array of parameters [deprecated]

4
2

call_user_method()

Call a user method on an specific object [deprecated]

4
3class_exists()

Checks if the class has been defined

4
4get_class_methods()

Gets the class methods' names

4
5get_class_vars()

Get the default properties of the class

4
6get_class()

Returns the name of the class of an object

4
7get_declared_classes()

Returns an array with the name of the defined classes

4
8get_declared_interfaces()

Returns an array of all declared interfaces

5
9get_object_vars()

Gets the properties of the given object

4
10get_parent_class()

Retrieves the parent class name for object or class

4
11interface_exists()

Checks if the interface has been defined

5
12is_a()

Checks if the object is of this class or has this class as one of its parents

4
13is_subclass_of ()

Checks if the object has this class as one of its parents

4
14method_exists()

Checks if the class method exists

4
15property_exists()

Checks if the object or class has a property


In our subsequent tutorials, we are going to be studying about each of the above functions.


Alright guys! This is where we are rounding up for this tutorial post. In our next tutorial guide, we are going to be discussing about the PHP class_exists() Function.

Feel free to ask your questions where necessary and i will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.

Thanks for reading and bye for now.
Share:

0 comments:

Post a Comment

Hello dear readers! Please kindly try your best to make sure your comments comply with our comment policy guidelines. You can visit our comment policy page to view these guidelines which are clearly stated. Thank you.