PHP Associative Array

In terms of functionality, associative arrays are fairly similar to numeric arrays, however, they differ in terms of the index. The index of an associative array will be a string, allowing you to create a strong link between key and value. PHP Associative Array Definition There are two ways of defining PHP associative array: 1. … Read more

Categories PHP

PHP Form Validation

PHP Form Validation is the process of verifying the user’s input. In PHP, there are two forms of validation. The following is a list of them: Client-Side Validation: It is used for field validation and is performed on client machine web browsers. Server-Side Validation: After form submission, data is forwarded to a server, which performs validation checks. … Read more

PHP Form Required Fields

This chapter explains how to make input fields required and, if necessary, provide error messages. PHP Form Required Fields Let’s look at a PHP for fields, some of which cannot be left blank and must be filled out: Field Validation Rules Name Required+ It can only contain letters and whitespaces. E-mail Required. + Must contain a … Read more

PHP File Upload

We’ll learn about the PHP file upload process in this chapter. With just a few lines of code, PHP allows you to upload single or many files. Configure The “php.ini” File First, make sure PHP is set up to accept file uploads. Look for the file uploads directive in your “php.ini” file and turn it on. … Read more

PHP OOP- Class and Object

A class is an independent set of variables and functions that interact to complete one or more tasks. Basically class is a template for multiple objects. While individual instances of a class are called objects. Class and Object Class Object A class is an independent set of variables and functions that interact to complete one or more … Read more

PHP – OOP

PHP-OOP is more efficient and simpler to use. PHP -What is OOP? Object-oriented programming is about constructing objects that include both data and functions, whereas procedural programming is about developing procedures or functions that perform actions on the data. There are various advantages of OOP over procedural programming: OOP programmes have a clear structure. It … Read more

PHP MySQL Database

The most often used database system with PHP is MySQL. MySQL: MySQL is a relational database management system that is free and open-source. The MySQL database system has a number of advantages: It is open-source and easy to install. MySQL is compatible with UNIX or Linux, Microsoft Windows and other operating systems. It is fast, … Read more

PHP OOP – Static Methods

Before moving to static methods let’s see the instance method. To utilize the class’s methods and properties, you must first construct an object and then use the object to access the class’s methods and properties. These methods and properties are referred to as instance methods and properties because they are tied to a specific instance … Read more

PHP OOP-Static Properties

Just like Static methods, Static properties can be called without having to create a class instance first. The static keyword is used to declare static methods: Static properties can be called from outside the class using the class name and the scope resolution operator (::), as seen below: Consider the following scenario: Static properties: Self Keyword: … Read more

PHP OOP – Traits

In PHP multiple inheritance is not supported, which implies a child class can only have one parent class. Traits allow you to easily reuse methods across several classes that don’t have to be in the same hierarchy. Traits allow classes to reuse code horizontally, whereas inheritance allows reusing code vertically. Methods that can be utilized across … Read more