Malhar Lathkar has Published 155 Articles

PHP Scope Resolution Operator (::)

Malhar Lathkar

Malhar Lathkar

Updated on 18-Sep-2020 11:37:12

6K+ Views

IntroductionIn PHP, the double colon :: is defined as Scope Resolution Operator. It used when when we want to access constants, properties and methods defined at class level. When referring to these items outside class definition, name of class is used along with scope resolution operator. This operator is also called Paamayim ... Read More

PHP Class properties

Malhar Lathkar

Malhar Lathkar

Updated on 18-Sep-2020 11:34:13

7K+ Views

IntroductionData members declared inside class are called properties. Property is sometimes referred to as attribute or field. In PHP, a property is qualified by one of the access specifier keywords, public, private or protected. Name of property could be any valid label in PHP. Value of property can be different ... Read More

PHP Objects and references

Malhar Lathkar

Malhar Lathkar

Updated on 18-Sep-2020 11:27:25

3K+ Views

IntroductionIn PHP, objects are passed by references by default. Here, reference is an alias, which allows two different variables to write to the same value. An object variable doesn't contain the object itself as value. It only contains an object identifier which allows using which the actual object is found. ... Read More

PHP Comparing Objects

Malhar Lathkar

Malhar Lathkar

Updated on 18-Sep-2020 11:25:02

3K+ Views

IntroductionPHP has a comparison operator == using which a simple comarison of two objecs variables can be performed. It returns true if both belong to same class and values of corresponding properties are are same.PHP's === operator compares two object variables and returns true if and only if they refer to same instance ... Read More

PHP Magic Methods

Malhar Lathkar

Malhar Lathkar

Updated on 18-Sep-2020 11:23:16

8K+ Views

IntroductionMagic methods in PHP are special methods that are aimed to perform certain tasks. These methods are named with double underscore (__) as prefix. All these function names are reserved and can't be used for any purpose other than associated magical functionality. Magical method in a class must be declared ... Read More

PHP Object Interfaces

Malhar Lathkar

Malhar Lathkar

Updated on 18-Sep-2020 11:15:49

513 Views

IntroductionInterface is an important feature of object oriented programming by which it is possible to specify methods to be implemented by a class, without having to define how they should be implemented.PHP supports interface by way if interface keyword. Interface is similar to class but with methods without definition body. ... Read More

PHP Object Inheritance

Malhar Lathkar

Malhar Lathkar

Updated on 18-Sep-2020 11:12:10

3K+ Views

IntroductionInheritance is an important principle of object oriented programming methodology. Using this principle, relation between two classes can be defined. PHP supports inheritance in its object model.PHP uses extends keyword to establish relationship between two classes.Syntaxclass B extends Awhere A is the base class (also called parent called) and B ... Read More

PHP Basics of Class and Object

Malhar Lathkar

Malhar Lathkar

Updated on 18-Sep-2020 09:47:28

2K+ Views

IntroductionClass is a user defined data type in PHP. In order to define a new class, PHP provides a keyword class, which is followed by a name. Any label that is valid as per PHP's naming convention (excluding PHP's reserved words) can be used as name of class. Constituents of ... Read More

PHP Autoloading Classes

Malhar Lathkar

Malhar Lathkar

Updated on 18-Sep-2020 09:45:17

2K+ Views

IntroductionIn order to use class defined in another PHP script, we can incorporate it with include or require statements. However, PHP's autoloading feature doesn't need such explicit inclusion. Instead, when a class is used (for declaring its object etc.) PHP parser loads it automatically, if it is registered with spl_autoload_register() ... Read More

PHP Declaring sub-namespaces

Malhar Lathkar

Malhar Lathkar

Updated on 18-Sep-2020 09:35:24

229 Views

IntroductionIt is possible to create namespaces inside a namespace. Just as a directory in file system can contain sub directories in a heriarchical structure, sub-namespaces can be arranged in hierarchy. The backslash character \ is used to define the relationship between top level and sub-level namespace, In this example toplevel namespace ... Read More

Previous 1 ... 7 8 9 10 11 ... 16 Next
Advertisements