design-patterns-php PHP PHP Design Patterns Tutorial 

PHP Design Patterns

Design Patterns : Patterns are ways to describe best practices and good designs. They show a flexible solution to common programming problems.   Factory Pattern : The Factory pattern allows for the instantiation of objects at runtime. It is called a Factory Pattern since it is responsible for “manufacturing” an object. A Parameterized Factory receives the name of the class to instantiate as argument.   Example : <?php class Example { // The parameterized factory method public static function factory($type) { if (include_once ‘Drivers/’ . $type . ‘.php’) { $classname…

Read More
classes and objects in php Object Oriented PHP PHP Tutorial 

Classes and Objects in PHP

Class : Every class definition begins with the keyword class, followed by a class name, which can be any name that isn’t a reserved word in PHP. Followed by a pair of curly braces, which contains the definition of the classes members and methods. A pseudo-variable, $this is available when a method is called from within an object context. $this is a reference to the calling object (usually the object to which the method belongs, but can be another object, if the method is called statically from the context of…

Read More