PHP Tutorial

PHP stands for "PHP: Hypertext Preprocessor". It is a widely-used Open Source general-purpose scripting language especially suited for web development. It can be embedded into HTML. The main goal of the language is to allow web developers to write dynamically generated web pages quickly, but you can do much more with PHP.

PHP Files
PHP Files

In order to write PHP code, you have to start the file with <?php. You can also finish the file or PHP code with ?>. You can mix PHP code with other content, like HTML, CSS, or JavaScript, in your PHP file as soon as you enclose the PHP bits with the <?php and ?> tags.

Read More

PHP Strings
PHP Strings

Strings are concatenations or series of characters that you cannot see at once when searching for something. Instead, you have to look one by one and keep track of what the content is. PHP has many predefined functions that help you in interacting with strings. Characters are letters, numbers, and punctuation. When a number is used as a character, it is just a stored character, the same as a letter. It can't be used in arithmetic.

Read More

Autoloading Classes
Autoloading Classes

In order to use a class, you need to include the file that defines it. Autoloading is a PHP feature that allows your program to search and load files automatically given some set of predefined rules. Each time you reference a class that PHP does not know about, it will ask the autoloader.

Read More

Abstract Class in PHP
Abstract Class in PHP

An abstract class provides a partial implementation that other classes can build upon. When a class is declared as abstract, it means that the class can contain incomplete methods that must be implemented in child classes, in addition to normal class members.

Read More

How to Connect Database with PHP
How to Connect Database with PHP

With PHP, you can connect to and make changes in the databases. The data in a MySQL database are stored in tables. A table is a collection of related data, and it consists of columns and rows. Databases are useful for storing information categorically.

For example, a company may have a database with the following tables - Employees, Products, Customers, Orders.

Read More

How to Execute MySQL Query in PHP
How to Execute MySQL Query in PHP

After you have successfully made a new database connection in PHP, you can execute MySQL queries from the PHP code itself. Store the query in a variable as a string. Then, you can use mysqli_query() to perform queries against the database.

Read More

How to Get Form Information in PHP
How to Get Form Information in PHP

The PHP superglobals $_GET and $_POST are used to collect form data submitted by the user. Several predefined variables in PHP are called superglobals. You can access them from any function, class or file without having to do anything special.

Read More

How to Copy Objects of Class
How to Copy Objects of Class

PHP provides a method you can use to copy an object. The method is __clone, with two underscores. You can write your own __clone method in a class if you want to specify statements to run when the object is copied. If you don’t write your own, PHP uses its default __clone method that copies all the properties as is.

Read More

How to Compare Objects of Class
How to Compare Objects of Class

At their simplest, objects are data types. You can compare objects with the equal operator, which is two equal signs (==), or with the identical operator, which is three equal signs (===).

Read More