Latest tutorials

Create MySQL Database in PHP

C

In the previous tutorial, we learned to establish a connection between PHP and MySQL using MySQLi and PDO. After making the connection, the very next step is to create a database. In this article, you will learn how to create a MySQL database in PHP. Create New Database using MySQLi (object-oriented) PHP provides CREATE DATABASE statement to the new database. In the following example, we will...

Connect to MySQL – PHP

C

Moving a step ahead towards MySQL with PHP, we will learn how to connect to MySQL database in PHP. Connect with MySQL in PHP There are two methods in PHP to make the connection with MySQL. MySQLi extensionPHP Data Objects (PDO) MySQLi is an improved version of MySQL which was used in the earlier versions of PHP. Which is better MySQLi or PDO? The answer depends on the scenario. Both of these...

PHP with MySQL Database

P

There are many databases that PHP supports but the MySQL database is the most popular among them. After going through the PHP Basics, Form Handling, Advanced topics, and then OOP, we are ready to start new Database series of PHP tutorials. MySQL database in PHP In this Database series, we will learn to connect, communicate and perform database operations. Hopefully, you will enjoy these things...

Iterables in PHP

I

What is an Iterable in PHP? Recall the loops tutorial in this PHP series and get to the foreach loop to be exact. In this article, you will learn iterables in PHP in link with foreach loop. Iterables is any value that foreach loop accept and is iterable.PHP 7.1 introduced this pseudo-data type and it can be used as return data type of functions. Also, function can accept iterables as its argument...

Namespaces in PHP

N

What are namespaces in PHP? Namespaces in PHP are also described as qualifiers that provide two main functions to the program. Using namesapce organize the code by grouping the classes of same nature into a single namespace.Namespace allows us to use same name for more than one class because they are wraped in the namespace. General Example of Namespaces For instance, we have a group of classes...

Static Properties in PHP OOP

S

Static keyword in PHP What are static properties in PHP? Just like we studied static methods in the previous tutorial, static properties in PHP are accessible within and outside the class directly. The static keyword is used to define the static properties of a class. To access the static properties of a class, we use the scope resolution operator :: <?php class Example { public static...

Static method in PHP OOP

S

In this tutorial. we will learn the static method in PHP. What are static methods in PHP? Static methods are created using static keyword.Static methods of a class are called directly. It means, we don’t need to create the instance of the class to call its static method.A class can contains both static and non-static methods.To call the static method of a class, we use scope resolution...

Traits in PHP

T

In this article, you will learn traits in PHP. PHP – What are Traits? In PHP, you can inherit from only one parent class. Traits overcome this limitation of PHP and allow you to inherit multiple behaviors. A trait is a class that contains both abstract and non-abstract methods. Different classes can use these methods in their own way. The trait methods can be public, private, or protected...

Interface in PHP

I

In this tutorial, we will learn the interface in PHP. What is an interface in OOP? An interface is a class that contains only abstract methods. By using the interface class, we can specify which methods a class should implement that extend the interface. Unlike abstract class, you don’t need to write abstracts with the methods because an interface can only have abstract methods in it...

Abstract Class in PHP OOP

A

In this article, we will learn abstract class in PHP. What is an abstract class in PHP? An abstract class contains the declaration of methods but not their definition. It only contains their names. It is the responsibility of the child class to define these methods. What is an abstract method? An abstract method is a method of an abstract class that is declared using abstract keywords and does...

Tutor Network