Category: PHP

  • 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…

  • OOP in PHP

    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. Why List Files? Listing files is useful…

  • 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 sub-directories. 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.…

  • Handle CSV File

    Popular spreadsheet programs use the CSV file format (which stands for Comma Separated Values) to export worksheet data in plain text. Each line in the file represents one row of the worksheet, with values in each column separated by commas. For example, a CSV file with names and ages might look like this − Name,Age…

  • Delete File

    In this chapter, we will learn how to remove a file using PHP. When maintaining data on a server, deleting files is an important step and PHP has simple methods to help with this. The unlink() Function PHP doesn’t have either a delete keyword or a delete() function. Instead, it provides the unlink() function, which when called, deletes a file from…

  • Append File

    Appending data to a file is a common PHP action. This chapter will show you how to do it step by step in simple ways. We will talk about what it means to append to a file, why you might want to do so, and how to do it with PHP code examples. What is…

  • Copy File

    When creating websites or applications in PHP, you may need to manage files. It involves generating, editing, moving and copying files. Copying files is an important step because it allows you to generate backups or duplicate resources without damaging the original file. With this chapter, we will see how to copy files with PHP. Different…

  • Download File

    In this chapter we will learn how to download files using PHP. This chapter is created for beginners, so we will explain everything step by step. By the end, you will know how to make it easy for users to download files from your website! Why Download Files in PHP? Websites commonly allow visitors to…