PHP Class Tutorial: Working with Methods

By | 21st September 2015

About the concepts of OOP in PHP5 from basics to very advanced level. We have learned about the class basic and public class properties in our previous tutorials. Today i am going to write about the basics of class methods.

“Class properties allow your objects to store data and class methods allow your objects to perform tasks.”

What are Class Methods

Methods are special functions declared within a class. As you might expect, a method declaration resembles a function declaration. The function keyword precedes a method name, followed by an optional list of argument variables in parentheses. The method body is enclosed by braces.

public function sample_method( $argument1, $argument2 ) {
// Method Logic
}
Category: PHP

Leave a Reply

Your e-mail address will not be published. Required fields are marked *