Category: 12. PHP

  •  Abstract Classes

    The list of reserved words in PHP includes the “abstract” keyword. When a class is defined with the “abstract” keyword, it cannot be instantiated, i.e., you cannot declare a new object of such a class. An abstract class can be extended by another class. As mentioned above, you cannot declare an object of this class. Hence,…

  • Class Constants

    PHP allows an identifier in a class to be defined as a “class constant” with a constant value, the one that remains unchanged on a per class basis. To differentiate from a variable or property within class, the name of the constant is not prefixed with the usual “$” symbol and is defined with the…

  • Inheritance

    Inheritance is one of the fundamental principles of object-oriented programming methodology. Inheritance is a software modelling approach that enables extending the capability of an existing class to build new class instead of building from scratch. PHP provides all the functionality to implement inheritance in its object model. Incorporating inheritance in PHP software development results in…

  • Access Modifiers

    In PHP, the keywords public, private and protected are known as the access modifiers. These keywords control the extent of accessibility or visibility of the class properties and methods. One of these keywords is prefixed while declaring the member variables and defining member functions. Whether the PHP code has free access to a class member, or it is restricted from…

  • Constructor and Destructor

    As in most of the object-oriented languages, you can define a constructor function in a class in PHP also. When you declare an object with the new operator, its member variables are not assigned any value. The constructor function is used to initialize every new object at the time of declaration. PHP also supports having…

  • Classes and Objects

    The concept of classes and objects is central to PHP’s object-oriented programming methodology. A class is the template description of its objects. It includes the properties and functions that process the properties. An object is the instance of its class. It is characterized by the properties and functions defined in the class. Defining a Class in PHP To define…

  • Object Oriented Programming in PH

    We can imagine our universe made of different objects like sun, earth, moon etc. Similarly we can imagine our car made of different objects like wheel, steering, gear etc. Same way there is object oriented programming concepts which assume everything as an object and implement a software using different objects. Object Oriented Concepts Before we…

  • Listing Files

    Windows command DIR and Linux command ls both display the list of files in the current directory. These commands can be operated with different switches to apply conditions on the list of files displayed. PHP provides a couple of options for programmatically listing files in a given directory. The readdir() Function The opendir() function in…

  • Create Directory

    Computer files are stored in the local storage device (called drive) in a hierarchical order, where a directory contains one or more files as well as subdirectories. Respective DOS commands defined in operating systems Windows, Linux etc. are used to create and manage directories. PHP provides directory management functions to create a directory, change the current…

  • File Permissions

    The concept of permissions is at the core of Unix/Linux file system. The permissions determine who can access a file and how one can access a file. File permissions in Linux are manipulated by the chmod command, which can be run inside the Linux terminal. PHP provides the chmod() function with which you can handle file permissions programmatically.…