PHP

PHP is a server-side scripting language which means that PHP scripts are executed on the server

PHP is an acronym for “PHP Hypertext Preprocessor”

PHP is enclosed in tags starting with <?php and ending with ?> as can be seen below.

<?php 

?>

This can be repeated multiple times within a single web page.

How a Web server processes PHP files


Suehring, Steve; Valade, Janet (2013-03-15). PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies (For Dummies (Computer/Tech)) (Kindle Locations 7708-7717). Wiley. Kindle Edition. 

Running a PHP File

A standard first PHP page will be to display that php is installed on the server. This will use a predefined function. The PHP script below will show the PHP information from the server.

Enter the code below and save it in  your web server’s folder and run it as demonstrated by your teacher.

E.g. 127.0.0.1/phpinfo.php or localhost/phpinfo.php

FileName: Phpinfo.php

PHP Variables

Variables in PHP must:

The code below will assign two variables and then add them together.

The . operator is used to concatenate strings together.

The echo function is used to display content on the page. You will notice that we can use it to write HTML tags.