PHP Introduction

PHP is an acronym for PHP Hypertext Processor. PHP files can contain HTML, CSS, and Javascript, which are run on a web server and sent to the browser as HTML.

PHP files end in the .php file extension.

What is PHP?

Basic PHP Syntax

A PHP script can be placed anywhere in the document.

A PHP script starts with <?php and ends with ?>

A simple PHP script

<?php echo "Hello World!"; ?>
PHP Variables

A variable starts with the $ followed by the name of the variable

Example

$firtName = "Baxter";

Rules for PHP Variables:

PHP Conditional Statements

In PHP we have the following conditional statements.

PHP Loops

In PHP we have the following loop types

Reference