PHP Tutorial


PHP is a widely-used server-side scripting language that can be used to build dynamic websites. It was originally created by Rasmus Lerdorf in 1994 and has since been maintained by the community. It's most often used with MySQL database management systems, but it also works with Microsoft SQL Server and PostgreSQL databases as well.

What is PHP?

PHP can also be used to create desktop applications, mobile apps and websites.

PHP is a general-purpose programming language that was created in 1994. It has evolved over the years and today it's one of the most popular languages for creating web applications (or "websites").

PHP has its roots in C, Java and Perl (it was originally called PHP/FI). Despite its name, there are no special characters in the alphabetical order; they're just numbers added together!

The PHP syntax

PHP is a scripting language, which means that it can be used to execute commands and text in your website. It uses curly brackets ({}) and semicolons (;) to separate blocks of code.

PHP uses similar syntax as HTML, but there are some differences:

PHP variables

PHP variables are used to store information in your PHP script. Variables can be defined and assigned values at any time, but they must be declared before they are used.

The following code shows a simple variable declaration:

The dollar sign ($) marks the beginning of a new line in your HTML document (or PHP script). You can also use two consecutive hyphens (-) to create a comment that will not be parsed by the interpreter. The semicolon (;) terminates statements when used as part of a statement group or for separating statements from each other within one statement block; otherwise it separates statements within an expression or function call..

Comments in PHP

Comments in PHP are used to help you organize your code and make it easier to read. They can be used to describe the purpose of a line of code, or they can be placed between other statements so that they're not executed. Comments are separated from the rest of the code by a semicolon (;).

In this tutorial we'll cover how to create comments in PHP and how you can use them in your own scripts. We'll also look at multi-line comments and how they differ from single-line ones - as well as how you can comment out lines of code within PHP if needed!