This post regarding how to autoload classes in PHP without included require method. Some rules you have to follow. 1) The file name must be the class name. Like if you declare a class like SampleClass then your file name should be the same name. 2) If you declare a namespace then your folder name
Tag: oop php
What is Namespaces and how it is used?
Namespaces are one of the most significant changes in PHP 5.3.Namespaces are a way of encapsulating items. As the size of your PHP code library increases, the more likely you will accidentally reuse a function or class name that has been declared before. The problem is exacerbated if you attempt to add third-party components or
What is Traits and How it is used?
Traits are one of the biggest addition in the PHP 5.4. In PHP trait is the method of code re-usability.As we know PHP is single inheritance programming language.As per my opinion, the main intention of introducing the trait in PHP is to reduce limitation of code re-usability in PHP single inheritance nature. The structure of