Monday, December 10, 2018

What is Pure PHP file?

You can create PHP files without any html tags and that is called Pure PHP file. The server interprets the PHP code and outputs the results as HTML code to the web browsers. In order for the server to identify the PHP code from the HTML code, we must always enclose the PHP code in PHP tags. A PHP tag starts with the less than symbol followed by the question mark and then the words “php”. PHP is a case sensitive language, “VAR” is not the same as “var”. 

The PHP tags themselves are not case-sensitive, but it is strongly recommended that we use lower case letter. The code below   illustrates the above point.

<?php … ?> 

We will be referring to the PHP lines of code as statements. PHP statements end with a semi colon (;). If you only have one statement, you can omit the semi colon. If you have more than one statement, then you must end each line with a semi colon. For the sake of consistency, it is recommended that you always end your statement(s) with a semi colon.  PHP scripts are executed on the server. The output is returned in form of HTML.

PHP Hello world 

The program shown below is a basic PHP application that outputs the words “Hello World!” When viewed in a web browser.

echo "Hello world";

Hello world 


Post a Comment