PHP OOP Classes

PHP OOP Classes

PHP OOP uses classes. The classes store the properties (similar to variables in procedural PHP) and methods similar to functions in procedural PHP). When you use classes, it does matter where you put them (from a functional point of view).

For example, you can create a class and insert it into your PHP for which you want to access the class. In fact, you could stack as many classes as you want in a file. But, many other applications that use PHP OOP tend to separate the classes in files with file names which are easy to identify.

For example, the class myclass could be used in a fiule called myclass.php. If classes are kept in individual files, it is easier to find and use them later in other pages for which you want to reuse the class.

Often, if you use various third party PHP scripts you may find some programmers have disorder, some keep all classes in separate files and some keep all parent and descendant classes in a single file.

class my_class {
}